could reproduce Problem with sw packages

This commit is contained in:
Peter Hormanns 2013-05-24 12:49:33 +02:00
parent e64adba33d
commit 9b8db6acd7
4 changed files with 13 additions and 5 deletions

View File

@ -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'; 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) 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'; 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) 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'; 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) INSERT INTO component (basepacket_id, basecomponent_id, min_quantity, max_quantity, default_quantity, increment_quantity, include_quantity, admin_only, article_number)

View File

@ -173,7 +173,11 @@ public class PacModuleImpl extends AbstractModuleImpl {
for (PacComponent pc : newPacComponents) { for (PacComponent pc : newPacComponents) {
BaseComponent bc = pc.getBaseComponent(); BaseComponent bc = pc.getBaseComponent();
String feature = bc.getFeature(); 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(); int increment = newBasepac.getComponent(feature).getIncrementQuantity();
if (quantity % increment != 0) { if (quantity % increment != 0) {
int numOfIncrements = quantity / increment; int numOfIncrements = quantity / increment;

View File

@ -87,6 +87,10 @@ public class InitDataTest {
try { try {
Object execute = client.execute(PAC_MODULE + ".add", params); Object execute = client.execute(PAC_MODULE + ".add", params);
assertTrue(execute instanceof Map<?, ?>); assertTrue(execute instanceof Map<?, ?>);
try { // wait for pac creation
Thread.sleep(10000L);
} catch (InterruptedException e) {
}
cas.setPassword(client, "aaa00"); cas.setPassword(client, "aaa00");
} catch (XmlRpcException e) { } catch (XmlRpcException e) {
fail(e.getMessage()); fail(e.getMessage());

View File

@ -63,7 +63,7 @@ public class PacMigrationTest {
String grantingTicketURL = cas.getGrantingTicketURL(user); String grantingTicketURL = cas.getGrantingTicketURL(user);
Object execute = addPac(user, grantingTicketURL, Object execute = addPac(user, grantingTicketURL,
"aaa05", BasePacType.PAC_SW, "176.9.242.77", "aaa05", BasePacType.PAC_SW, "176.9.242.77",
1024, 8, 0); 1024, 8, -1);
assertEquals(count + 1, getPacsCount()); assertEquals(count + 1, getPacsCount());
validateAddedPac(execute, BasePacType.PAC_SW, 1024, 8, -1); validateAddedPac(execute, BasePacType.PAC_SW, 1024, 8, -1);
setPacAdminPassword(user, grantingTicketURL, "aaa05", "test123"); setPacAdminPassword(user, grantingTicketURL, "aaa05", "test123");
@ -186,7 +186,9 @@ public class PacMigrationTest {
HashMap<String, String> components = new HashMap<String, String>(); HashMap<String, String> components = new HashMap<String, String>();
components.put("QUOTA", Integer.toString(quota)); components.put("QUOTA", Integer.toString(quota));
components.put("TRAFFIC", Integer.toString(traffic)); components.put("TRAFFIC", Integer.toString(traffic));
if (daemons >= 0) {
components.put("DAEMON", Integer.toString(daemons)); components.put("DAEMON", Integer.toString(daemons));
}
setParams.put("components", components); setParams.put("components", components);
Object[] params = new Object[] { user, Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),