| | |
| | | import org.opends.server.types.RDN; |
| | | import org.testng.annotations.AfterClass; |
| | | import org.testng.annotations.BeforeClass; |
| | | import org.testng.annotations.DataProvider; |
| | | import org.testng.annotations.Test; |
| | | |
| | | /** |
| | |
| | | broker.stop(); |
| | | } |
| | | |
| | | @DataProvider(name="assured") |
| | | public Object[][] getAssuredFlag() |
| | | { |
| | | return new Object[][] { { false }, {true} }; |
| | | } |
| | | /** |
| | | * Tests done using directly the ChangelogBroker interface. |
| | | */ |
| | | @Test(enabled=true) |
| | | public void updateOperations() throws Exception |
| | | @Test(enabled=true, dataProvider="assured") |
| | | public void updateOperations(boolean assured) throws Exception |
| | | { |
| | | final DN baseDn = DN.decode("ou=People,dc=example,dc=com"); |
| | | |
| | | cleanEntries(); |
| | | |
| | | ChangelogBroker broker = openChangelogSession(baseDn, (short) 3); |
| | | ChangeNumberGenerator gen = new ChangeNumberGenerator((short) 3, 0); |
| | | |
| | |
| | | * loop receiving update until there is nothing left |
| | | * to make sure that message from previous tests have been consumed. |
| | | */ |
| | | broker.setSoTimeout(100); |
| | | // broker.setSoTimeout(100); |
| | | try |
| | | { |
| | | while (true) |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | broker.setSoTimeout(1000); |
| | | // broker.setSoTimeout(1000); |
| | | } |
| | | /* |
| | | * Test that operations done on this server are sent to the |
| | |
| | | */ |
| | | |
| | | // Create an Entry (add operation) |
| | | Entry tmp = personEntry.duplicate(); |
| | | AddOperation addOp = new AddOperation(connection, |
| | | InternalClientConnection.nextOperationID(), InternalClientConnection |
| | | .nextMessageID(), null, personEntry.getDN(), personEntry |
| | | .getObjectClasses(), personEntry.getUserAttributes(), personEntry |
| | | .getOperationalAttributes()); |
| | | .nextMessageID(), null, tmp.getDN(), |
| | | tmp.getObjectClasses(), tmp.getUserAttributes(), |
| | | tmp.getOperationalAttributes()); |
| | | addOp.run(); |
| | | entryList.add(personEntry); |
| | | assertNotNull(DirectoryServer.getEntry(personEntry.getDN()), |
| | |
| | | user1entryUUID, baseUUID, |
| | | personWithUUIDEntry.getObjectClassAttribute(), |
| | | personWithUUIDEntry.getAttributes(), new ArrayList<Attribute>()); |
| | | if (assured) |
| | | addMsg.setAssured(); |
| | | broker.publish(addMsg); |
| | | |
| | | /* |
| | |
| | | */ |
| | | modMsg = new ModifyMsg(gen.NewChangeNumber(), personWithUUIDEntry.getDN(), |
| | | mods, user1entryUUID); |
| | | if (assured) |
| | | modMsg.setAssured(); |
| | | broker.publish(modMsg); |
| | | |
| | | boolean found = checkEntryHasAttribute(personWithUUIDEntry.getDN(), |
| | |
| | | gen.NewChangeNumber(), |
| | | user1entryUUID, null, |
| | | true, null, "uid= new person"); |
| | | if (assured) |
| | | moddnMsg.setAssured(); |
| | | broker.publish(moddnMsg); |
| | | |
| | | resultEntry = getEntry( |
| | |
| | | */ |
| | | delMsg = new DeleteMsg("uid= new person,ou=People,dc=example,dc=com", |
| | | gen.NewChangeNumber(), user1entryUUID); |
| | | if (assured) |
| | | delMsg.setAssured(); |
| | | broker.publish(delMsg); |
| | | resultEntry = getEntry( |
| | | DN.decode("uid= new person,ou=People,dc=example,dc=com"), 1000, false); |