SynchronizationMsgTest.java revision 4e2ebfb0527383913ff439a9d742c0536de6c8f7
/*
* 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
* 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
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. 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
*
*
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
/**
* Test the contructors, encoders and decoders of the synchronization
* AckMsg, ModifyMsg, ModifyDnMsg, AddMsg and Delete Msg
*/
public class SynchronizationMsgTest extends ReplicationTestCase
{
/**
* Build some data for the ModifyMsg test below.
*/
public Object[][] createData() {
(short) 123, (short) 45);
new LinkedHashSet<AttributeValue>();
for (int i =0; i< 10; i++)
{
new LinkedHashSet<AttributeValue>();
}
return new Object[][] {
{ cn2, "dc=test with a much longer dn in case this would "
+ "make a difference", mods1},
};
}
/**
* 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.
*/
throws Exception
{
/*
* TODO : test that the generated mod equals the original mod.
*/
}
/**
* Create a Update Message 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.
*/
throws Exception
{
// Check uuid
// Check isAssured
msg.setAssured();
// Check equals
// Check hashCode
// Check compareTo
// Check Get / Set DN
}
/**
* Build some data for the DeleteMsg test below.
*/
public Object[][] createDelData() {
return new Object[][] {
{"dc=com"},
{"dc=delete,dc=an,dc=entry,dc=with,dc=a,dc=long dn"},
};
}
/**
* 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.
*/
throws Exception
{
(short) 123, (short) 45);
// Create an update message from this op
}
public Object[][] createModifyDnData() {
return new Object[][] {
{"dc=test,dc=com", "dc=new", false, "dc=change"},
{"dc=test,dc=com", "dc=new", true, "dc=change"},
// testNG does not like null argument so use "" for the newSuperior
// instead of null
{"dc=test,dc=com", "dc=new", false, ""},
{"dc=delete,dc=an,dc=entry,dc=with,dc=a,dc=long dn",
"dc=new",true, ""},
};
}
throws Exception
{
(short) 123, (short) 45);
// Create an update message from this op
}
public Object[][] createAddData() {
return new Object[][] {
{"dc=test,dc=com"},
};
}
throws Exception
{
new LinkedHashSet<AttributeValue>();
"organization"));
"objectClass", ocValues);
"organization");
(short) 123, (short) 45);
.getBytes());
// TODO : should test that generated attributes match original attributes.
// Create an new Add Operation from the current addMsg
// TODO : should test that generated attributes match original attributes.
// List<LDAPAttribute> rawAtt = addOp.getRawAttributes();
//Create an Add operation and generate and Add msg from it
"parentUniqueId");
// TODO : should test that generated attributes match original attributes.
// Create an update message from this op
}
/**
* Build some data for the AckMsg test below.
*/
public Object[][] createAckData() {
(short) 123, (short) 45);
return new Object[][] {
{cn1},
{cn2}
};
}
throws Exception
{
// Consctructor test (with ChangeNumber)
// Chech that retrieved CN is OK
// Consctructor test (with byte[])
// Check that retrieved CN is OK
// Check invalid bytes for constructor
try
{
// This should generated an exception
msg2 = new AckMessage(b);
assertTrue(false);
}
catch (DataFormatException e)
{
assertTrue(true);
}
// Check that retrieved CN is OK
}
{
}
/**
* Test that ServerStartMessage encoding and decoding works
* by checking that : msg == new ServerStartMessage(msg.getBytes()).
*/
{
}
{
}
/**
* Test that changelogStartMessage encoding and decoding works
* by checking that : msg == new ReplServerStartMessage(msg.getBytes()).
*/
{
}
/**
* Test that WindowMessageTest encoding and decoding works
* by checking that : msg == new WindowMessage(msg.getBytes()).
*/
@Test()
public void WindowMessageTest() throws Exception
{
}
/**
* Test that WindowProbe encoding and decoding works
* by checking that : new WindowProbe(msg.getBytes()) does not throws
* an exception.
*/
@Test()
public void WindowProbeTest() throws Exception
{
}
/**
* Test that EntryMessage encoding and decoding works
* by checking that : msg == new EntryMessageTest(msg.getBytes()).
*/
@Test()
public void EntryMessageTest() 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.tasks.InitializeTask" +
"ds-task-initialize-domain-dn: dc=example,dc=com" +
"ds-task-initialize-source: 1");
short sender = 1;
short target = 2;
}
/**
* Test that InitializeRequestMessage encoding and decoding works
*/
@Test()
public void InitializeRequestMessageTest() throws Exception
{
short sender = 1;
short target = 2;
}
/**
* Test that InitializeTargetMessage encoding and decoding works
*/
@Test()
public void InitializeTargetMessageTest() throws Exception
{
short senderID = 1;
short targetID = 2;
short requestorID = 3;
long entryCount = 4;
}
/**
* Test that DoneMessage encoding and decoding works
*/
@Test()
public void DoneMessage() throws Exception
{
}
/**
* Test that ErrorMessage encoding and decoding works
*/
@Test()
public void ErrorMessage() throws Exception
{
}
}