| | |
| | | import org.opends.server.tasks.TaskUtils; |
| | | import static org.opends.server.util.ServerConstants.OC_TOP; |
| | | import static org.opends.server.util.ServerConstants.OC_EXTENSIBLE_OBJECT; |
| | | import org.opends.server.config.ConfigEntry; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.*; |
| | | |
| | |
| | | |
| | | public class TestRebuildJob extends JebTestCase |
| | | { |
| | | private String cfgDN= |
| | | "ds-cfg-backend-id=rebuildRoot,cn=Backends,cn=config"; |
| | | private String beID="rebuildRoot"; |
| | | private static String suffix="dc=rebuild,dc=jeb"; |
| | | private static String vBranch="ou=rebuild tests," + suffix; |
| | |
| | | //Attribute type in stat entry containing error count |
| | | private String errorCount="verify-error-count"; |
| | | |
| | | private DN configDN; |
| | | private DN[] baseDNs; |
| | | private ConfigEntry configEntry; |
| | | private BackendImpl be; |
| | | |
| | | @DataProvider(name = "systemIndexes") |
| | |
| | | @BeforeClass |
| | | public void setup() throws Exception { |
| | | TestCaseUtils.startServer(); |
| | | configDN = DN.decode(cfgDN); |
| | | baseDNs = new DN[] { |
| | | DN.decode(suffix) |
| | | }; |
| | | configEntry = DirectoryServer.getConfigEntry(configDN); |
| | | } |
| | | |
| | | @AfterClass |
| | |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | be.rebuildBackend(rebuildConfig); |
| | | |
| | | assertEquals(verifyBackend("mail"), 0); |
| | | |
| | |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | be.rebuildBackend(rebuildConfig); |
| | | } |
| | | |
| | | @Test(dataProvider = "systemIndexes", |
| | |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | be.rebuildBackend(rebuildConfig); |
| | | } |
| | | |
| | | @Test(dataProvider = "systemIndexes") |
| | | public void testRebuildSystemIndexesOffline(String index) throws Exception |
| | | { |
| | | cleanAndLoad(10); |
| | | cleanAndLoad(10); |
| | | RebuildConfig rebuildConfig = new RebuildConfig(); |
| | | rebuildConfig.setBaseDN(baseDNs[0]); |
| | | rebuildConfig.addRebuildIndex(index); |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, false); |
| | | TaskUtils.disableBackend(beID); |
| | | |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | be.rebuildBackend(rebuildConfig); |
| | | |
| | | //TODO: Verify dn2uri database as well. |
| | | if(!index.equalsIgnoreCase("dn2uri")) |
| | |
| | | assertEquals(verifyBackend(index), 0); |
| | | } |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, true); |
| | | TaskUtils.enableBackend(beID); |
| | | } |
| | | |
| | | @Test |
| | |
| | | |
| | | be=(BackendImpl) DirectoryServer.getBackend(beID); |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, false); |
| | | TaskUtils.disableBackend(beID); |
| | | |
| | | be.rebuildBackend(rebuildConfig, configEntry, baseDNs); |
| | | be.rebuildBackend(rebuildConfig); |
| | | |
| | | assertEquals(verifyBackend(null), 0); |
| | | |
| | | TaskUtils.setBackendEnabled(configEntry, true); |
| | | TaskUtils.enableBackend(beID); |
| | | } |
| | | |
| | | @Test |
| | |
| | | verifyConfig.addCleanIndex(index); |
| | | } |
| | | Entry statEntry=bldStatEntry(""); |
| | | be.verifyBackend(verifyConfig, configEntry, baseDNs, statEntry); |
| | | be.verifyBackend(verifyConfig, statEntry); |
| | | |
| | | return getStatEntryCount(statEntry, errorCount); |
| | | } |