diff --git a/hsarback/database/data.sql b/hsarback/database/data.sql index 5f0fed3..52b9a9d 100644 --- a/hsarback/database/data.sql +++ b/hsarback/database/data.sql @@ -53,8 +53,6 @@ INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quanti SELECT basepacket_id, basecomponent_id, 5, 40960, 5, 5, 0, false, 302 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='TRAFFIC'; 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, 4, 0, 1, 0, false, 103 FROM basepacket, basecomponent WHERE basepacket_code='PAC/DW' AND basecomponent_code='DAEMON'; -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, 0, 0, 1, 0, false, 203 FROM basepacket, basecomponent WHERE basepacket_code='PAC/SW' AND basecomponent_code='DAEMON'; 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, 4, 0, 1, 0, false, 303 FROM basepacket, basecomponent WHERE basepacket_code='PAC/WEB' AND basecomponent_code='DAEMON'; INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number) diff --git a/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java b/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java index 85ce549..84761af 100644 --- a/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java +++ b/hsarback/src/de/hsadmin/mods/pac/PacModuleImpl.java @@ -173,7 +173,11 @@ public class PacModuleImpl extends AbstractModuleImpl { for (PacComponent pc : newPacComponents) { BaseComponent bc = pc.getBaseComponent(); String feature = bc.getFeature(); - int quantity = oldQuantities.get(feature).intValue(); + Integer oldQuantity = oldQuantities.get(feature); + int quantity = 0; + if (oldQuantity != null) { + quantity = oldQuantity.intValue(); + } int increment = newBasepac.getComponent(feature).getIncrementQuantity(); if (quantity % increment != 0) { int numOfIncrements = quantity / increment; diff --git a/hsarback/test/de/hsadmin/remote/InitDataTest.java b/hsarback/test/de/hsadmin/remote/InitDataTest.java index 392053b..a74dd0d 100644 --- a/hsarback/test/de/hsadmin/remote/InitDataTest.java +++ b/hsarback/test/de/hsadmin/remote/InitDataTest.java @@ -87,6 +87,10 @@ public class InitDataTest { try { Object execute = client.execute(PAC_MODULE + ".add", params); assertTrue(execute instanceof Map); + try { // wait for pac creation + Thread.sleep(10000L); + } catch (InterruptedException e) { + } cas.setPassword(client, "aaa00"); } catch (XmlRpcException e) { fail(e.getMessage()); diff --git a/hsarback/test/de/hsadmin/remote/PacMigrationTest.java b/hsarback/test/de/hsadmin/remote/PacMigrationTest.java index c807fc4..42e2c81 100644 --- a/hsarback/test/de/hsadmin/remote/PacMigrationTest.java +++ b/hsarback/test/de/hsadmin/remote/PacMigrationTest.java @@ -63,7 +63,7 @@ public class PacMigrationTest { String grantingTicketURL = cas.getGrantingTicketURL(user); Object execute = addPac(user, grantingTicketURL, "aaa05", BasePacType.PAC_SW, "176.9.242.77", - 1024, 8, 0); + 1024, 8, -1); assertEquals(count + 1, getPacsCount()); validateAddedPac(execute, BasePacType.PAC_SW, 1024, 8, -1); setPacAdminPassword(user, grantingTicketURL, "aaa05", "test123"); @@ -186,7 +186,9 @@ public class PacMigrationTest { HashMap components = new HashMap(); components.put("QUOTA", Integer.toString(quota)); components.put("TRAFFIC", Integer.toString(traffic)); - components.put("DAEMON", Integer.toString(daemons)); + if (daemons >= 0) { + components.put("DAEMON", Integer.toString(daemons)); + } setParams.put("components", components); Object[] params = new Object[] { user, cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),