SynchronizationMsgTest.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* 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 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* Test the constructors, encoders and decoders of the replication protocol
* PDUs classes (message classes)
*/
@SuppressWarnings("javadoc")
public class SynchronizationMsgTest extends ReplicationTestCase
{
private DN TEST_ROOT_DN;
/**
* Set up the environment for performing the tests in this Class.
*
* @throws Exception
* If the environment could not be set up.
*/
{
super.setUp();
}
/**
* Build some data for the ModifyMsg test below.
*/
public Object[][] createModifyData() {
for (int i = 0; i < 10; i++)
{
}
return new Object[][] {
{ csn2, "dc=test with a much longer dn in case this would "
{ csn2, "dc=test, cn=with a, o=more complex, ou=dn", mods1, false, AssuredMode.SAFE_READ_MODE, (byte)5, eclIncludes},
{ csn2, "dc=test with several mod", mods2, false, AssuredMode.SAFE_DATA_MODE, (byte)16, eclIncludes},
};
}
/**
* Create a ModifyMsg from the data provided above.
* The call getBytes() to test the encoding of the Msg and
* create another ModifyMsg from the encoded byte array.
* Finally test that both Msg matches.
*/
byte safeDataLevel,
throws Exception
{
// Set ECL entry included attributes
if (entryAttrList != null)
{
}
// Test that generated attributes match original attributes.
// Get ECL entry attributes
}
/**
* Create an Update LocalizableMessage from the data provided above.
* The call getBytes() to test the encoding of the Msg and
* create another ModifyMsg from the encoded byte array.
* Finally test that both Msgs match.
*/
byte safeDataLevel ,
throws Exception
{
// Check isAssured
// Check assured mode
// Check safe data level
// Check equals
// Check CSN
// Check hashCode
// Check compareTo
// Check Get / Set DN
// Check uuid
// Check assured flag
// Check assured mode
// Check safe data level
}
/**
* Build some data for the DeleteMsg test below.
*/
public Object[][] createDeleteData()
{
return new Object[][] {
{"dc=com", entryAttrList, false},
{"dc=delete,dc=an,dc=entry,dc=with,dc=a,dc=long dn", null, true},
};
}
{
return newList(
}
/**
* Create a Delete from the data provided above.
* The call getBytes() to test the encoding of the Msg and
* create another DeleteMsg from the encoded byte array.
* Finally test that both Msg matches.
*/
boolean subtree)
throws Exception
{
if (subtree)
{
}
// Set ECL entry attributes
if (entryAttrList != null)
{
}
// Get ECL entry attributes
// Create an update message from this op
}
public Object[][] createModifyDnData() {
for (int i = 0; i < 10; i++)
{
}
return new Object[][] {
{"dc=test,dc=com", "dc=new", false, "dc=change", mods1, false, AssuredMode.SAFE_DATA_MODE, (byte)0, entryAttrList},
{"dc=test,dc=com", "dc=new", true, "dc=change", mods2, true, AssuredMode.SAFE_READ_MODE, (byte)1, null},
// testNG does not like null argument so use "" for the newSuperior instead of null
{"dc=test,dc=com", "dc=new", false, "", mods3, true, AssuredMode.SAFE_READ_MODE, (byte)3, entryAttrList},
{"dc=delete,dc=an,dc=entry,dc=with,dc=a,dc=long dn",
};
}
throws Exception
{
{
}
// Set ECL entry attributes
if (entryAttrList != null)
{
}
// Test that generated attributes match original attributes.
// Get ECL entry attributes
// Create an update message from this op
}
public Object[][] createAddData()
{
return new Object[][] {
}
throws Exception
{
.getObjectClassAttributeType(), "organization");
"organization");
// Set ECL entry attributes
if (entryAttrList != null)
{
}
// Test that generated attributes match original attributes.
// Get ECL entry attributes
// Create an new Add Operation from the current addMsg
//Create an Add operation and generate and Add msg from it
"parentUniqueId");
if (entryAttrList != null)
{
}
// TODO : should test that generated attributes match original attributes.
// Create an update message from this op
}
{
if (expectedAttrs == null)
{
return;
}
{
}
}
/**
* Build some data for the AckMsg test below.
*/
public Object[][] createAckData() {
return new Object[][] {
};
}
throws Exception
{
// Constructor test (with CSN)
// Check that retrieved CSN is OK
// Check default values for error info
// Check constructor with error info
// Constructor test (with byte[])
// Check invalid bytes for constructor
try
{
// This should generated an exception
fail("Expected DataFormatException");
}
catch (DataFormatException expected)
{
}
// Check that retrieved CSN is OK
}
{
return new Object[][]
{
};
}
/**
* Test that ServerStartMsg encoding and decoding works
* by checking that : msg == new ServerStartMsg(msg.getBytes()).
*/
{
}
{
return new Object[][]
{
};
}
/**
* Test that ReplServerStartMsg encoding and decoding works
* by checking that : msg == new ReplServerStartMsg(msg.getBytes()).
*/
{
}
/**
* Test that StopMsg encoding and decoding works
* by checking that : msg == new StopMsg(msg.getBytes()).
*/
@Test
public void stopMsgTest() throws Exception
{
}
@Test
public void changeTimeHeartbeatMsgTest() throws Exception
{
}
short version) throws DataFormatException
{
}
@Test
public void replicaOfflineMsgTest() throws Exception
{
}
/**
* Test that WindowMsg encoding and decoding works
* by checking that : msg == new WindowMsg(msg.getBytes()).
*/
@Test
public void windowMsgTest() throws Exception
{
}
/**
* Test that WindowProbeMsg encoding and decoding works
* by checking that : new WindowProbeMsg(msg.getBytes()) does not throws
* an exception.
*/
@Test
public void windowProbeMsgTest() throws Exception
{
}
{
"ldaps://ldap.iplanet.com:4041/uid=bjensen,ou=People,"
+ TEST_ROOT_DN_STRING + "?cn,mail,telephoneNumber");
return new Object[][] {
};
}
/**
* Test TopologyMsg encoding and decoding.
*/
throws Exception
{
}
/**
* Provider for the StartSessionMsg test.
*/
public Object[][] createStartSessionData()
{
TEST_ROOT_DN_STRING + "?cn,mail,telephoneNumber");
+ "?sub?(&(departmentnumber=04*) (l=Juneau))");
return new Object[][]{
};
}
/**
* Test StartSessionMsg encoding and decoding.
*/
throws Exception
{
}
/**
* Provider for the ChangeStatusMsg test
*/
public Object[][] createChangeStatusData()
{
return new Object[][]{
};
}
/**
* Test ChangeStatusMsg encoding and decoding.
*/
throws Exception
{
}
/**
* Test HeartbeatMsg encoding and decoding.
*/
@Test
public void heartbeatMsgTest() throws Exception
{
}
/**
* Test ResetGenerationIdMsg encoding and decoding.
*/
@Test
public void resetGenerationIdMsgTest() throws Exception
{
}
/**
* Test MonitorRequestMsg encoding and decoding.
*/
@Test
public void monitorRequestMsgTest() throws Exception
{
}
/**
* Test MonitorMsg.
*/
@Test
public void monitorMsgTest() throws Exception
{
int sender = 2;
int dest = 3;
// RS State
// LS1 state
int sid1 = 111;
// LS2 state
int sid2 = 222;
long now = 10;
// LS3 state
int sid3 = 56789;
{
{
}
{
}
else
{
}
}
{
{
}
else
{
}
}
}
/**
* Test that EntryMsg encoding and decoding works
* by checking that : msg == new EntryMessageTest(msg.getBytes()).
*/
@Test
public void entryMsgTest() throws Exception
{
",cn=Scheduled Tasks,cn=Tasks\n" +
"objectclass: top\n" +
"objectclass: ds-task\n" +
"objectclass: ds-task-initialize\n" +
"ds-task-class-name: org.opends.server.replication.api.InitializeTask\n" +
"ds-task-initialize-source: 1\n");
int sender = 1;
int target = 45678;
}
/**
* Test that InitializeRequestMsg encoding and decoding works
*/
@Test
public void initializeRequestMsgTest() throws Exception
{
int sender = 1;
int target = 56789;
InitializeRequestMsg newMsg = new InitializeRequestMsg(msg.getBytes(getCurrentVersion()),getCurrentVersion());
}
/**
* Test that InitializeTargetMsg encoding and decoding works
*/
@Test
public void initializeTargetMsgTest() throws Exception
{
int senderID = 45678;
int targetID = 2;
int requestorID = 3;
long entryCount = 4;
int initWindow = 100;
InitializeTargetMsg newMsg = new InitializeTargetMsg(msg.getBytes(getCurrentVersion()),getCurrentVersion());
}
/**
* Test that DoneMsg encoding and decoding works
*/
@Test
public void doneMsgTest() throws Exception
{
}
/**
* Test that ErrorMsg encoding and decoding works
*/
@Test
public void errorMsgTest() throws Exception
{
}
/**
* Test Generic UpdateMsg
*/
@Test
public void UpdateMsgTest() throws Exception
{
}
private int perfRep = 100000;
{
long createop = 0;
long createmsgfromop = 0;
long encodemsg = 0;
long getbytes = 0;
long setentryattr = 0;
long buildnew = 0;
for (int i=1;i<perfRep;i++)
{
// create op
"parentUniqueId");
// create msg from op
// set entry attr
// encode msg
// getBytes
// getBytes
}
"addMsgPerfs "
+ "createop\t"
+ "createmsgfromop\t"
+ "setentryattr\t"
+ "encodemsg\t"
+ "getbytes\t"
+ "buildnew\t");
"addMsgPerfs "
}
{
long createop = 0;
long createmsgfromop = 0;
long encodemsg = 0;
long getbytes = 0;
long setentryattr = 0;
long buildnew = 0;
for (int i=1;i<perfRep;i++)
{
// create op
// create msg from op
// set entry attr
// generatedMsg.setEntryAttributes(entryAttrList);
// encode msg
// getBytes
// getBytes
}
"modMsgPerfs "
+ "createop\t"
+ "createmsgfromop\t"
+ "setentryattr\t"
+ "encodemsg\t"
+ "getbytes\t"
+ "buildnew\t");
"modMsgPerfs "
}
throws Exception
{
long createop = 0;
long createmsgfromop = 0;
long encodemsg = 0;
long getbytes = 0;
long setentryattr = 0;
long buildnew = 0;
for (int i=1;i<perfRep;i++)
{
// create op
// create msg from op
// set entry attr
//generatedMsg.setEntryAttributes(entryAttrList);
// encode msg
// getBytes
// getBytes
}
"deleteMsgPerfs "
+ "createop\t"
+ "createmsgfromop\t"
+ "setentryattr\t"
+ "encodemsg\t"
+ "getbytes\t"
+ "buildnew\t");
"deleteMsgPerfs "
}
}