From c9f5e29792b89edafec6305b7a587b17c72f822a Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@jalin.de>
Date: Wed, 01 May 2013 13:51:55 +0200
Subject: [PATCH] data and test for pac.add SRV/MDG

---
 hsarback/test/de/hsadmin/remote/PacTest.java |   39 ++++++++++++++++++++++++++++++++++++++-
 hsarback/database/data.sql                   |   12 +++++++++++-
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql
index 4aa7a45..ad2c5fb 100644
--- a/hsarback/database/data.sql
+++ b/hsarback/database/data.sql
@@ -25,6 +25,10 @@
 	VALUES ('MIRROR', 'Echtzeitspiegelung der Daten', 500, true);
 INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
 	VALUES ('BACKUP', 'Nächtliches Backup', 600, true);
+INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
+	VALUES ('DISK', 'Nächtliches Backup', 700, true);
+INSERT INTO basecomponent (basecomponent_code, description, sorting, valid)
+	VALUES ('CPU', 'Nächtliches Backup', 800, true);
 
 --
 -- Table: component
@@ -65,7 +69,13 @@
 	SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 205 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND  basecomponent_code='BACKUP';
 INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
 	SELECT basepacket_id, basecomponent_id, 0, 1, 1, 1, 1, false, 305 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND  basecomponent_code='BACKUP';
-
+INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
+	SELECT basepacket_id, basecomponent_id, 25, 100, 25, 25, 0, false, 410 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND  basecomponent_code='DISK';
+INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
+	SELECT basepacket_id, basecomponent_id, 1, 16, 1, 1, 0, false, 420 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND  basecomponent_code='CPU';
+INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)
+	SELECT basepacket_id, basecomponent_id, 10, 1000, 10, 10, 0, false, 430 FROM basepacket, basecomponent WHERE basepacket_code='SRV/MGD' AND  basecomponent_code='TRAFFIC';
+	
 --
 -- Table: business_partner 
 --
diff --git a/hsarback/test/de/hsadmin/remote/PacTest.java b/hsarback/test/de/hsadmin/remote/PacTest.java
index 2ac5c8e..952f724 100644
--- a/hsarback/test/de/hsadmin/remote/PacTest.java
+++ b/hsarback/test/de/hsadmin/remote/PacTest.java
@@ -85,7 +85,7 @@
 	}
 
 	@Test
-	public void testCreate() {
+	public void testCreateWeb() {
 		int count = getPacsCount();
 		String user = "ad";
 		String grantingTicketURL = cas.getGrantingTicketURL(user);
@@ -124,6 +124,43 @@
 		}
 	}
 
+	@Test
+	public void testCreateMdg() {
+		int count = getPacsCount();
+		String user = "ad";
+		String grantingTicketURL = cas.getGrantingTicketURL(user);
+		Map<String, Object> setParams = new HashMap<String, Object>();
+		setParams.put("name", "aaa90");
+		setParams.put("hive", "h99");
+		setParams.put("customer", config.getProperty("accountprefix.customer") + "-aaa");
+		setParams.put("basepac", Pac.PAC_SRV);
+		setParams.put("curinetaddr", "176.9.242.76");
+		setParams.put("free", "true");
+		Object[] params = new Object[] { user, 
+				cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), 
+				setParams };
+		try {
+			Object execute = client.execute(MODULE + ".add", params);
+			assertTrue(execute instanceof Map<?, ?>);
+		} catch (XmlRpcException e) {
+			fail(e.getMessage());
+		}
+		assertEquals(count + 1, getPacsCount());
+		Map<String, String> whereParams = new HashMap<String, String>();
+		whereParams.put("name", "aaa90");
+		params = new Object[] { user, 
+				cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), 
+				whereParams };
+		try {
+			Object execute = client.execute(MODULE + ".search", params);
+			assertTrue(execute instanceof Object[]);
+			Object[] resultArr = (Object[]) execute;
+			assertEquals(1, resultArr.length);
+		} catch (XmlRpcException e) {
+			fail(e.getMessage());
+		}
+	}
+
 //	@Test
 	public void testDelete() {
 		int count = getPacsCount();

--
Gitblit v1.9.3