Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<release-note> rfe10175: support dynamic catalogs With this change, the java client now supports dynamic creation and deletion of catalogs with AGServer methods createCatalog, getCatalog and deleteCatalog. Note that the server needs to be started using the DynamicCatalogs directive in the agraph.cfg file in order to create or delete catalogs dynamically. </release-note> Added prepush test DynamicCatalogTests make prepush passes make javadoc runs clean Change-Id: I1b64c8fa0dea9f2e322c2c2649b13e51ab8d0e96 Reviewed-on: https://gerrit.franz.com:9080/1200 Reviewed-by: Ahmon Dancy <dancy@franz.com> Reviewed-by: Kevin Layer <layer@franz.com> Tested-by: Kevin Layer <layer@franz.com>
- Loading branch information
Showing
4 changed files
with
124 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/****************************************************************************** | ||
** Copyright (c) 2008-2010 Franz Inc. | ||
** All rights reserved. This program and the accompanying materials | ||
** are made available under the terms of the Eclipse Public License v1.0 | ||
** which accompanies this distribution, and is available at | ||
** http://www.eclipse.org/legal/epl-v10.html | ||
******************************************************************************/ | ||
|
||
package test; | ||
|
||
import junit.framework.Assert; | ||
|
||
import org.junit.Test; | ||
import org.junit.experimental.categories.Category; | ||
|
||
import com.franz.agraph.http.exception.AGHttpException; | ||
import com.franz.agraph.repository.AGCatalog; | ||
|
||
public class DynamicCatalogTests extends AGAbstractTest { | ||
|
||
@Test | ||
@Category(TestSuites.Prepush.class) | ||
public void dynamicCatalogs_rfe10175() throws Exception { | ||
String catalogID = "dynamicCatalog1"; | ||
String repoID = "repo1"; | ||
AGCatalog catalog = server.createCatalog(catalogID); | ||
Assert.assertNotNull("missing the expected catalog", server.getCatalog(catalogID)); | ||
// should be ok to create an existing catalog | ||
int numCatalogs = server.listCatalogs().size(); | ||
catalog = server.createCatalog(catalogID); | ||
Assert.assertEquals("expected no change in catalogs", numCatalogs, server.listCatalogs().size()); | ||
catalog.createRepository(repoID); | ||
Assert.assertTrue("expected repository", catalog.hasRepository(repoID)); | ||
server.deleteCatalog(catalogID); | ||
Assert.assertNull("expected catalog to be deleted", server.getCatalog(catalogID)); | ||
try { | ||
// catalog object shouldn't work either | ||
catalog.hasRepository(repoID); | ||
Assert.fail("expected catalog not found exception."); | ||
} catch (AGHttpException e) { | ||
// TODO: want a subclass of AGHttpException here? | ||
} | ||
// should be ok to delete a non-existent catalog | ||
numCatalogs = server.listCatalogs().size(); | ||
server.deleteCatalog(catalogID); | ||
Assert.assertEquals("expected no change in catalogs", numCatalogs, server.listCatalogs().size()); | ||
server.createCatalog(catalogID); | ||
// catalog object now works again (allow that for now. TODO: reconsider?) | ||
// When a catalog is deleted, repositories aren't accessible from the catalog | ||
// TODO: check that repositories are also deleted from disk? | ||
Assert.assertTrue("Expected no repositories in catalog.",!catalog.hasRepository(repoID)); | ||
server.deleteCatalog(catalogID); | ||
Assert.assertNull("expected catalog to be deleted", server.getCatalog(catalogID)); | ||
// TODO confirm that these are indeed harmless | ||
server.deleteCatalog("/"); | ||
server.deleteCatalog("blahdiblah"); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters