### Question:
SingleFileLdifPartition extends AbstractLdifPartition { @Override public void move( MoveOperationContext moveContext ) throws LdapException { synchronized ( lock ) { super.move( moveContext ); dirty = true; rewritePartitionData( moveContext.getTransaction() ); } } SingleFileLdifPartition( SchemaManager schemaManager, DnFactory dnFactory ); @Override void add( AddOperationContext addContext ); @Override void modify( ModifyOperationContext modifyContext ); @Override void rename( RenameOperationContext renameContext ); @Override void move( MoveOperationContext moveContext ); @Override void moveAndRename( MoveAndRenameOperationContext opContext ); @Override Entry delete( PartitionTxn partitionTxn, String id ); void setEnableRewriting( PartitionTxn partitionTxn, boolean enableRewriting );  }### Answer:
@Test public void testLdifMoveEntry() throws Exception { SingleFileLdifPartition partition = injectEntries(); Entry childEntry1 = partition.fetch( partition.beginReadTransaction(), partition.getEntryId( partition.beginReadTransaction(), new Dn( schemaManager, "cn=child1,ou=test,ou=system" ) ) ); Entry childEntry2 = partition.fetch( partition.beginReadTransaction(), partition.getEntryId( partition.beginReadTransaction(), new Dn( schemaManager, "cn=child2,ou=test,ou=system" ) ) ); MoveOperationContext moveOpCtx = new MoveOperationContext( mockSession, childEntry1.getDn(), childEntry2.getDn() ); moveOpCtx.setPartition( partition ); moveOpCtx.setTransaction( partition.beginWriteTransaction() ); partition.move( moveOpCtx ); partition = reloadPartition(); assertExists( partition, childEntry2 ); assertNotExists( partition, childEntry1 ); assertExists( partition, "cn=child1,cn=child2,ou=test,ou=system" ); assertExists( partition, "cn=grandChild11,cn=child1,cn=child2,ou=test,ou=system" ); assertExists( partition, "cn=grandChild12,cn=child1,cn=child2,ou=test,ou=system" ); assertExists( partition, "cn=greatGrandChild111,cn=grandChild11,cn=child1,cn=child2,ou=test,ou=system" ); }
@Test public void testLdifMoveSubChildEntry() throws Exception { SingleFileLdifPartition partition = injectEntries(); Entry childEntry1 = partition.fetch( partition.beginReadTransaction(), partition.getEntryId( partition.beginReadTransaction(), new Dn( schemaManager, "cn=grandChild11,cn=child1,ou=test,ou=system" ) ) ); Entry childEntry2 = partition.fetch( partition.beginReadTransaction(), partition.getEntryId( partition.beginReadTransaction(), new Dn( schemaManager, "cn=child2,ou=test,ou=system" ) ) ); MoveOperationContext moveOpCtx = new MoveOperationContext( mockSession, childEntry1.getDn(), childEntry2.getDn() ); moveOpCtx.setPartition( partition ); moveOpCtx.setTransaction( partition.beginWriteTransaction() ); partition.move( moveOpCtx ); partition = reloadPartition(); assertExists( partition, childEntry2 ); assertNotExists( partition, childEntry1 ); assertExists( partition, "cn=child1,ou=test,ou=system" ); assertExists( partition, "cn=child2,ou=test,ou=system" ); assertExists( partition, "cn=grandChild11,cn=child2,ou=test,ou=system" ); assertExists( partition, "cn=grandChild12,cn=child1,ou=test,ou=system" ); assertExists( partition, "cn=greatGrandChild111,cn=grandChild11,cn=child2,ou=test,ou=system" ); }