diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2009-11-03 09:35:25 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2009-11-03 09:35:25 -0400 |
commit | 96326852ee7f152ec6ceb0d841a6eabc272462a2 (patch) | |
tree | 72a6ab20094c1ab0825457c73fc8dc68b4d0ba29 | |
parent | 9688edb9809d435132cbb6bc3501a4ed7db60328 (diff) | |
download | cobbler-96326852ee7f152ec6ceb0d841a6eabc272462a2.tar.gz cobbler-96326852ee7f152ec6ceb0d841a6eabc272462a2.tar.xz cobbler-96326852ee7f152ec6ceb0d841a6eabc272462a2.zip |
cobbler4j: Fix Finder to call correct XMLRPC methods.
Also tests Repo creation and deletion fully.
3 files changed, 15 insertions, 6 deletions
diff --git a/cobbler4j/src/org/fedorahosted/cobbler/Finder.java b/cobbler4j/src/org/fedorahosted/cobbler/Finder.java index 513b2055..dda30384 100644 --- a/cobbler4j/src/org/fedorahosted/cobbler/Finder.java +++ b/cobbler4j/src/org/fedorahosted/cobbler/Finder.java @@ -39,7 +39,7 @@ public class Finder { Map<String, String> criteria = new HashMap<String, String>(); criteria.put(critera, value); List<Map<String, Object>> objects = (List<Map<String, Object>>) - client.invokeMethod(type.getName(), criteria); + client.invokeMethod("find_" + type.getName(), criteria); return maps2Objects(client, type, objects); } diff --git a/cobbler4j/src/org/fedorahosted/cobbler/test/Fixture.java b/cobbler4j/src/org/fedorahosted/cobbler/test/Fixture.java index 6f7cb12c..18057a79 100644 --- a/cobbler4j/src/org/fedorahosted/cobbler/test/Fixture.java +++ b/cobbler4j/src/org/fedorahosted/cobbler/test/Fixture.java @@ -10,11 +10,13 @@ public class Fixture { public static final String user = "testing"; public static final String pass = "testing"; public static CobblerConnection cobblercon; + public static Finder finder; @BeforeClass public static void establishConnection() { cobblercon = new CobblerConnection("http://192.168.1.1", user, pass); + finder = Finder.getInstance(); } } diff --git a/cobbler4j/src/org/fedorahosted/cobbler/test/RepoTests.java b/cobbler4j/src/org/fedorahosted/cobbler/test/RepoTests.java index 44227b6c..84f97c70 100644 --- a/cobbler4j/src/org/fedorahosted/cobbler/test/RepoTests.java +++ b/cobbler4j/src/org/fedorahosted/cobbler/test/RepoTests.java @@ -1,8 +1,6 @@ package org.fedorahosted.cobbler.test; -import java.util.List; import org.junit.Test; -import org.junit.BeforeClass; import static org.junit.Assert.*; import org.fedorahosted.cobbler.autogen.*; @@ -12,15 +10,24 @@ public class RepoTests extends Fixture { @Test public void createRepo() { + + String repoToCreate = "testrepo"; + Repo newRepo = new Repo(cobblercon); - newRepo.setName("testrepo"); + newRepo.setName(repoToCreate); newRepo.setMirror("rsync://centos.arcticnetwork.ca/centos/5.4/os/i386/"); newRepo.commit(); + Repo lookedUp = (Repo)finder.findItemByName(cobblercon, + ObjectType.REPO, repoToCreate); + assertEquals(lookedUp.getName(), repoToCreate); + // Now remove it: newRepo.remove(); - - // TODO: Make sure it's gone... + + lookedUp = (Repo)finder.findItemByName(cobblercon, + ObjectType.REPO, repoToCreate); + assertNull(lookedUp); } } |