fix error: packet is now created as requested

This commit is contained in:
Peter Hormanns 2013-04-25 12:08:39 +02:00
parent d61b2a2b35
commit 9148f924b2
6 changed files with 21 additions and 9 deletions

View File

@ -2,11 +2,13 @@
-- Table: basepacket
--
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('DW/B', 'Dynamic-Web/Base', 200, true, 100);
VALUES ('DW/B', 'Dynamic-Web/Base', 300, true, 100);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('SW/B', 'Static-Web/Base', 300, true, 200);
VALUES ('SW/B', 'Static-Web/Base', 400, true, 200);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('PAC', 'PAC/Web', 100, true, 300);
VALUES ('WEB', 'Web/Base', 100, true, 300);
INSERT INTO basepacket (basepacket_code, description, sorting, valid, article_number)
VALUES ('HIVE', 'Managed Server', 200, true, 400);
--
-- Table: basecomponent

View File

@ -158,4 +158,9 @@ public class BasePac implements Serializable {
public void setArticleNumber(int articleNumber) {
this.articleNumber = articleNumber;
}
@Override
public String toString() {
return "BasePac \"" + getName() + "\"";
}
}

View File

@ -37,6 +37,11 @@ import de.hsadmin.mods.user.UnixUser;
@AnnModuleImpl(de.hsadmin.mods.pac.PacModuleImpl.class)
public class Pac extends AbstractEntity implements Serializable {
public static final String PAC_WEB_BASE = "WEB";
public static final String PAC_HIVE = "HIVE";
public static final String PAC_DW_BASE = "DW/B";
public static final String PAC_SW_BASE = "SW/B";
private static final long serialVersionUID = 1L;
@Id

View File

@ -25,7 +25,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
EntityManager em, T entity) throws ProcessorException {
Pac pac = (Pac) entity;
String basepacName = pac.getBasepac().getName();
if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) {
if (basepacName.equals(Pac.PAC_WEB_BASE) || basepacName.equals(Pac.PAC_DW_BASE) || basepacName.equals(Pac.PAC_SW_BASE)) {
String pacName = pac.getName();
Hive hive = pac.getHive();
UnixUser unixUser = getPacAdminUser(pac);
@ -79,7 +79,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
throws ProcessorException {
Pac pac = (Pac) entity;
String basepacName = pac.getBasepac().getName();
if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) {
if (basepacName.equals(Pac.PAC_WEB_BASE) || basepacName.equals(Pac.PAC_DW_BASE) || basepacName.equals(Pac.PAC_SW_BASE)) {
return createSetQuotaProc(pac);
} else {
return new NullProcessor();
@ -90,7 +90,7 @@ public class PacProcessorFactory implements EntityProcessorFactory {
public <T extends AbstractEntity> Processor createDeleteProcessor(EntityManager em, T entity) throws ProcessorException {
Pac pac = (Pac) entity;
String basepacName = pac.getBasepac().getName();
if (basepacName.startsWith("PAC") || basepacName.startsWith("DW") || basepacName.startsWith("SW")) {
if (basepacName.equals(Pac.PAC_WEB_BASE) || basepacName.equals(Pac.PAC_DW_BASE) || basepacName.equals(Pac.PAC_SW_BASE)) {
Hive hive = pac.getHive();
WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName()));
waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor(

View File

@ -51,7 +51,7 @@ public class PacRemote extends AbstractRemote {
Pac pac = (Pac) entity;
BasePac basePac = pac.getBasepac();
String basePacName = (String) setParams.get("basepac");
if ((basePac == null || basePac.getName() == null) && assertNotNull(basePacName)) {
if (assertNotNull(basePacName)) {
basePac = new BasePac();
basePac.setName(basePacName);
pac.setBasepac(basePac);

View File

@ -77,7 +77,7 @@ public class InitDataTest {
setParams.put("name", "aaa00");
setParams.put("hive", "h99");
setParams.put("customer", "hsh00-aaa");
setParams.put("basepac", "PAC/WEB");
setParams.put("basepac", "WEB");
setParams.put("curinetaddr", "176.9.242.74");
Object[] params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),