summaryrefslogtreecommitdiffstats
path: root/proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2009-11-26 10:47:56 -0400
committerDevan Goodwin <dgoodwin@redhat.com>2009-11-26 10:47:56 -0400
commitbefa9401ccde73c219c0dcb837f34f712aa9891d (patch)
treed60fca3c645675d0286b226ad0068c06a479673e /proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java
parentde2aeeae880b9fd5bd1dfb6600bc23d6530f68d4 (diff)
downloadcandlepin-befa9401ccde73c219c0dcb837f34f712aa9891d.tar.gz
candlepin-befa9401ccde73c219c0dcb837f34f712aa9891d.tar.xz
candlepin-befa9401ccde73c219c0dcb837f34f712aa9891d.zip
Begin mapping Consumer to database.
Implications to a lot of other areas outside the model. Currently one test still failing, will be fixed soon.
Diffstat (limited to 'proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java')
-rw-r--r--proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java55
1 files changed, 55 insertions, 0 deletions
diff --git a/proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java b/proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java
new file mode 100644
index 0000000..a1c7874
--- /dev/null
+++ b/proxy/code/src/org/fedoraproject/candlepin/test/TestUtil.java
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2009 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package org.fedoraproject.candlepin.test;
+
+import org.fedoraproject.candlepin.model.BaseModel;
+import org.fedoraproject.candlepin.model.Consumer;
+import org.fedoraproject.candlepin.model.ObjectFactory;
+import org.fedoraproject.candlepin.model.Owner;
+import org.fedoraproject.candlepin.model.Product;
+
+// TODO: Do we want to keep this style of creating objects for testing?
+@Deprecated
+public class TestUtil {
+ private TestUtil() {
+ }
+
+ public static Owner createOwner() {
+ Owner o = new Owner("Test Owner");
+// o.setUuid(lookedUp);
+ ObjectFactory.get().store(o);
+ return o;
+ }
+
+ public static Consumer createConsumer(Owner owner) {
+ Consumer c = new Consumer("Consumer Name", owner);
+ ObjectFactory.get().store(c);
+ return c;
+ }
+
+ /**
+ * Create a consumer with a new owner
+ * @return Consumer
+ */
+ public static Consumer createConsumer() {
+ return createConsumer(createOwner());
+ }
+
+ public static Product createProduct() {
+ Product rhel = new Product("rhel-label", "Red Hat Enterprise Linux");
+ ObjectFactory.get().store(rhel);
+ return rhel;
+ }
+}