Incorporate various TUV patches: r1836,r1837,r1838,r1839,r1840,r1841,r1842,r1843,r1849,r1850,r1859 (various code clean up, compile fixes, Windows fixes, new UriParameter class)
git-svn-id: https://svn.libreccm.org/ccm/trunk@98 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
01e3da6984
commit
2d1bbe17f6
|
|
@ -1,6 +1,8 @@
|
|||
parameter_is_required=This parameter is required
|
||||
parameter_not_unique=This parameter is not unique
|
||||
string_in_range=This parameter is not between {0} and {1} characters long
|
||||
type_check={0} must be of type {1} but got {2} of type {3}
|
||||
parameter.only.letters.digits=This parameter can only contain letters and/or digits
|
||||
file_empty_or_not_found=is empty or was not found.
|
||||
file_too_large=is too large
|
||||
uri_parameter_is_invalid=This parameter must be a URI formatted according to RFC2396
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
parameter_is_required=Dieser Parameter ist erforderlich
|
||||
parameter_not_unique=Dieser Parameter ist nicht einzigartig
|
||||
string_in_range=Dieser Parameter ist nicht zwischen {0} und {1} Zeichen lang
|
||||
type_check={0} muss vom Typ {1} sein, ist aber {2} vom Typ {3}
|
||||
parameter.only.letters.digits=Dieser Parameter darf nur Buchstaben und/oder Zahlen enthalten
|
||||
file_empty_or_not_found=ist leer oder wurde nicht gefunden.
|
||||
file_too_large=ist zu gro\u00DF
|
||||
uri_parameter_is_invalid=Dieser Parameter muss ein URI sein, das entsprechend RFC2396 formatiert wird
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
parameter_is_required=This parameter is required
|
||||
parameter_not_unique=This parameter is not unique
|
||||
string_in_range=This parameter is not between {0} and {1} characters long
|
||||
type_check={0} must be of type {1} but got {2} of type {3}
|
||||
parameter.only.letters.digits=This parameter can only contain letters and/or digits
|
||||
file_empty_or_not_found=is empty or was not found.
|
||||
file_too_large=is too large
|
||||
uri_parameter_is_invalid=This parameter must be a URI formatted according to RFC2396
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Permeance Technologies Pty Ltd. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.bebop.parameters;
|
||||
|
||||
/**
|
||||
* A parameter that contains a URI formatted according to <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC2396</a>:
|
||||
*
|
||||
* @see URIValidationListener
|
||||
*
|
||||
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||
*/
|
||||
public class URIParameter extends StringParameter {
|
||||
|
||||
public URIParameter(String name) {
|
||||
super(name);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (C) Permeance Technologies Pty Ltd. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.bebop.parameters;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.event.ParameterEvent;
|
||||
import com.arsdigita.bebop.event.ParameterListener;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* A parameter listener that ensures a parameter is a URI formatted
|
||||
* according to <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC2396</a>:
|
||||
*
|
||||
* <blockquote>
|
||||
* <pre>
|
||||
* The following examples illustrate URI that are in common use.
|
||||
*
|
||||
* ftp://ftp.is.co.za/rfc/rfc1808.txt
|
||||
* -- ftp scheme for File Transfer Protocol services
|
||||
*
|
||||
* gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles
|
||||
* -- gopher scheme for Gopher and Gopher+ Protocol services
|
||||
*
|
||||
* http://www.math.uio.no/faq/compression-faq/part1.html
|
||||
* -- http scheme for Hypertext Transfer Protocol services
|
||||
*
|
||||
* mailto:mduerst@ifi.unizh.ch
|
||||
* -- mailto scheme for electronic mail addresses
|
||||
*
|
||||
* news:comp.infosystems.www.servers.unix
|
||||
* -- news scheme for USENET news groups and articles
|
||||
*
|
||||
* telnet://melvyl.ucop.edu/
|
||||
* -- telnet scheme for interactive services via the TELNET Protocol
|
||||
* </pre>
|
||||
* </blockquote>
|
||||
*
|
||||
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||
*/
|
||||
public class URIValidationListener extends GlobalizedParameterListener {
|
||||
|
||||
public URIValidationListener() {
|
||||
setError(new GlobalizedMessage("uri_parameter_is_invalid", getBundleBaseName()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ParameterListener#validate(ParameterEvent)
|
||||
*/
|
||||
public void validate(ParameterEvent e) throws FormProcessException {
|
||||
|
||||
ParameterData d = e.getParameterData();
|
||||
String value = (String)d.getValue();
|
||||
|
||||
if (value != null && value.length() > 0) {
|
||||
try {
|
||||
URI uri = new URI(value);
|
||||
if (!uri.isAbsolute()) {
|
||||
d.addError(this.getError());
|
||||
}
|
||||
} catch (URISyntaxException ex) {
|
||||
d.addError(this.getError());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (C) Permeance Technologies Pty Ltd. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.bebop.parameters;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.event.ParameterEvent;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.SessionManager;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
||||
/**
|
||||
* Validates that a {@link String} property of a {@link DomainObject} is unique.
|
||||
*
|
||||
* @author <a href="https://sourceforge.net/users/terry_permeance/">terry_permeance</a>
|
||||
*/
|
||||
public class UniqueStringValidationListener extends GlobalizedParameterListener
|
||||
{
|
||||
public UniqueStringValidationListener(String baseDataObjectType, String propertyKey,
|
||||
ParameterModel domainParameter) {
|
||||
|
||||
this.setError(new GlobalizedMessage("parameter_not_unique", this.getBundleBaseName()));
|
||||
Assert.exists(baseDataObjectType);
|
||||
Assert.exists(propertyKey);
|
||||
Assert.exists(domainParameter);
|
||||
m_baseDataObjectType = baseDataObjectType;
|
||||
m_propertyKey = propertyKey;
|
||||
m_domainParameter = domainParameter;
|
||||
}
|
||||
|
||||
public void validate(ParameterEvent e) throws FormProcessException {
|
||||
|
||||
ParameterData data = e.getParameterData();
|
||||
String propertyValue = (data.getValue() == null ? null : String.valueOf(data.getValue()));
|
||||
|
||||
if (propertyValue != null && propertyValue.length() > 0) {
|
||||
// Get the current domain object
|
||||
DomainObject domainObject = (DomainObject) e.getPageState().getValue(m_domainParameter);
|
||||
|
||||
// Check if there are any existing matches
|
||||
DataCollection collection = SessionManager.getSession().retrieve(m_baseDataObjectType);
|
||||
collection.addEqualsFilter(m_propertyKey, propertyValue);
|
||||
while (collection.next()) {
|
||||
if (domainObject == null || !collection.getDataObject().getOID().equals(domainObject.getOID())) {
|
||||
data.addError(this.getError());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final String m_baseDataObjectType;
|
||||
|
||||
private final String m_propertyKey;
|
||||
|
||||
private final ParameterModel m_domainParameter;
|
||||
}
|
||||
|
|
@ -19,6 +19,8 @@
|
|||
package com.arsdigita.installer;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
@ -37,7 +39,7 @@ import org.apache.log4j.Logger;
|
|||
|
||||
public abstract class SQLLoader {
|
||||
|
||||
public final static String versionId = "$Id: SQLLoader.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
public final static String versionId = "$Id: SQLLoader.java 1839 2009-03-05 07:50:52Z terry $ by $Author: terry $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(SQLLoader.class);
|
||||
|
||||
|
|
@ -56,8 +58,9 @@ public abstract class SQLLoader {
|
|||
|
||||
final SQLLoader loader = new SQLLoader(conn) {
|
||||
protected final Reader open(final String name) {
|
||||
String resourceName = name.replace('\\', '/');
|
||||
final ClassLoader cload = getClass().getClassLoader();
|
||||
final InputStream is = cload.getResourceAsStream(name);
|
||||
final InputStream is = cload.getResourceAsStream(resourceName);
|
||||
|
||||
if (is == null) {
|
||||
return null;
|
||||
|
|
@ -124,11 +127,11 @@ public abstract class SQLLoader {
|
|||
|
||||
private String parent(String path) {
|
||||
path = path.trim();
|
||||
if (path.endsWith("/")) {
|
||||
if (path.endsWith(File.separator)) {
|
||||
path = path.substring(0, path.length() - 2);
|
||||
}
|
||||
|
||||
int index = path.lastIndexOf('/');
|
||||
int index = path.lastIndexOf(File.separatorChar);
|
||||
if (index > 0) {
|
||||
path = path.substring(0, index);
|
||||
} else {
|
||||
|
|
@ -157,7 +160,7 @@ public abstract class SQLLoader {
|
|||
if (front == null) {
|
||||
resolved = back;
|
||||
} else {
|
||||
resolved = front + "/" + back;
|
||||
resolved = front + File.separatorChar + back;
|
||||
}
|
||||
|
||||
if (s_log.isDebugEnabled()) {
|
||||
|
|
|
|||
|
|
@ -18,19 +18,23 @@
|
|||
*/
|
||||
package com.arsdigita.kernel.security;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
|
||||
/**
|
||||
* A unit of data that contains a string value, an expiration date, and a
|
||||
* tamper-proof validator. A Credential can be converted to and from a
|
||||
|
|
@ -42,7 +46,6 @@ import org.apache.commons.codec.binary.Base64;
|
|||
**/
|
||||
public class Credential {
|
||||
|
||||
public static final String versionId = "$Id: Credential.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
/**
|
||||
* The character used to separate the value, expiration, and validator.
|
||||
**/
|
||||
|
|
@ -73,7 +76,7 @@ public class Credential {
|
|||
StringBuffer buf = new StringBuffer();
|
||||
buf.append(m_value).append(SEPARATOR);
|
||||
buf.append(m_expiration).append(SEPARATOR);
|
||||
buf.append(new String(new Base64().encode(m_validator)));
|
||||
buf.append(URLEncoder.encode(new String(new Base64().encode(m_validator))));
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
|
|
@ -190,7 +193,7 @@ public class Credential {
|
|||
throws CredentialParsingException, CredentialExpiredException {
|
||||
|
||||
// split string into value, expiration, and validator
|
||||
StringTokenizer tok = new StringTokenizer(credential,
|
||||
StringTokenizer tok = new StringTokenizer(URLDecoder.decode(credential),
|
||||
String.valueOf(SEPARATOR));
|
||||
if (tok.countTokens() != 3) {
|
||||
throw new CredentialParsingException("Bad format");
|
||||
|
|
|
|||
|
|
@ -18,6 +18,15 @@
|
|||
*/
|
||||
package com.arsdigita.loader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.mail.internet.InternetAddress;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.kernel.EmailAddress;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
|
|
@ -33,32 +42,26 @@ import com.arsdigita.kernel.permissions.PermissionService;
|
|||
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||
import com.arsdigita.kernel.permissions.UniversalPermissionDescriptor;
|
||||
import com.arsdigita.kernel.security.KeyStorage;
|
||||
import com.arsdigita.ui.admin.Admin;
|
||||
import com.arsdigita.ui.sitemap.SiteMap;
|
||||
import com.arsdigita.mimetypes.ImageMimeType;
|
||||
import com.arsdigita.mimetypes.MimeTypeExtension;
|
||||
import com.arsdigita.mimetypes.MimeType;
|
||||
import com.arsdigita.mimetypes.MimeTypeExtension;
|
||||
import com.arsdigita.mimetypes.TextMimeType;
|
||||
import com.arsdigita.portal.Portal;
|
||||
import com.arsdigita.runtime.ScriptContext;
|
||||
import com.arsdigita.ui.admin.Admin;
|
||||
import com.arsdigita.ui.sitemap.SiteMap;
|
||||
import com.arsdigita.util.Assert;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.csv.CSVParameterLoader;
|
||||
import com.arsdigita.util.parameter.EmailParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
import com.arsdigita.util.servlet.HttpHost;
|
||||
import com.arsdigita.util.StringUtils;
|
||||
import com.arsdigita.web.Host;
|
||||
import com.arsdigita.web.Web;
|
||||
import com.arsdigita.web.Application;
|
||||
import com.arsdigita.web.ApplicationType;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import com.arsdigita.web.Host;
|
||||
import com.arsdigita.web.Web;
|
||||
|
||||
/**
|
||||
* CoreLoader
|
||||
|
|
@ -69,12 +72,11 @@ import org.apache.log4j.Logger;
|
|||
|
||||
public class CoreLoader extends PackageLoader {
|
||||
|
||||
public final static String versionId = "$Id: CoreLoader.java 287 2005-02-22 00:29:02Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
public final static String versionId = "$Id: CoreLoader.java 1841 2009-03-05 07:52:42Z terry $ by $Author: terry $, $DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(CoreLoader.class);
|
||||
|
||||
private StringParameter m_email = new StringParameter
|
||||
("waf.admin.email", Parameter.REQUIRED, null);
|
||||
private EmailParameter m_email = new EmailParameter("waf.admin.email");
|
||||
|
||||
private StringParameter m_screen = new StringParameter
|
||||
("waf.admin.name.screen", Parameter.OPTIONAL, null) {
|
||||
|
|
@ -135,7 +137,7 @@ public class CoreLoader extends PackageLoader {
|
|||
}
|
||||
|
||||
private String getEmail() {
|
||||
return (String) get(m_email);
|
||||
return ((InternetAddress) get(m_email)).toString();
|
||||
}
|
||||
|
||||
private String getScreen() {
|
||||
|
|
|
|||
|
|
@ -18,25 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.loader;
|
||||
|
||||
import com.arsdigita.installer.SQLLoader;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.runtime.AbstractScript;
|
||||
// pboy (Jan.09):
|
||||
// deprecated without recommended replacement
|
||||
// created Interactive ParameterReader as a replacement
|
||||
// import com.arsdigita.runtime.InteractiveParameterLoader;
|
||||
import com.arsdigita.runtime.InteractiveParameterReader;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
// deprecated, use c.ad.util.JavaPropertyReader instead
|
||||
// import com.arsdigita.util.config.JavaPropertyLoader;
|
||||
import com.arsdigita.util.JavaPropertyReader;
|
||||
// deprecated, use c.ad.util.parameter.CompoundParameterReader instead
|
||||
// import com.arsdigita.util.parameter.CompoundParameterLoader;
|
||||
import com.arsdigita.util.parameter.CompoundParameterReader;
|
||||
// deprecated, use c.ad.util.parameter.ParameterReader instead
|
||||
// import com.arsdigita.util.parameter.ParameterLoader;
|
||||
import com.arsdigita.util.parameter.ParameterReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -53,6 +34,16 @@ import java.util.Properties;
|
|||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.arsdigita.installer.SQLLoader;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.Session;
|
||||
import com.arsdigita.runtime.AbstractScript;
|
||||
import com.arsdigita.runtime.InteractiveParameterReader;
|
||||
import com.arsdigita.util.JavaPropertyReader;
|
||||
import com.arsdigita.util.UncheckedWrapperException;
|
||||
import com.arsdigita.util.parameter.CompoundParameterReader;
|
||||
import com.arsdigita.util.parameter.ParameterReader;
|
||||
|
||||
/**
|
||||
* PackageLoader
|
||||
*
|
||||
|
|
@ -65,8 +56,8 @@ public abstract class PackageLoader extends AbstractScript {
|
|||
public final static Logger s_log = Logger.getLogger(PackageLoader.class);
|
||||
|
||||
public final static String versionId =
|
||||
"$Id: PackageLoader.java 287 2005-02-22 00:29:02Z sskracic $" +
|
||||
" by $Author: sskracic $, " +
|
||||
"$Id: PackageLoader.java 1840 2009-03-05 07:51:20Z terry $" +
|
||||
" by $Author: terry $, " +
|
||||
"$DateTime: 2004/08/16 18:10:38 $";
|
||||
|
||||
public static boolean exists(Connection conn, String table) {
|
||||
|
|
@ -116,12 +107,13 @@ public abstract class PackageLoader extends AbstractScript {
|
|||
public static void load(Connection conn, String script) {
|
||||
SQLLoader loader = new SQLLoader(conn) {
|
||||
protected Reader open(String name) {
|
||||
String resourceName = name.replace('\\', '/');
|
||||
ClassLoader cload = getClass().getClassLoader();
|
||||
InputStream is = cload.getResourceAsStream(name);
|
||||
InputStream is = cload.getResourceAsStream(resourceName);
|
||||
if (is == null) {
|
||||
return null;
|
||||
} else {
|
||||
s_log.info("Loading: " + name);
|
||||
s_log.info("Loading: " + resourceName);
|
||||
return new InputStreamReader(is);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,8 @@ public class HostInit {
|
|||
}
|
||||
} else {
|
||||
if (s_log.isInfoEnabled()) {
|
||||
s_log.info("Entry found in file that does not correspond to an installed package: " + line);
|
||||
s_log.info("Entry found in file that does not correspond " +
|
||||
"to an installed package: " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -205,7 +206,8 @@ public class HostInit {
|
|||
while ((line = reader.readLine()) != null) {
|
||||
line = line.trim();
|
||||
if (contains(line, packages) && line.endsWith(".jar")) {
|
||||
String newline = line.substring(0, line.lastIndexOf(".jar")) + "-system.jar";
|
||||
String newline = line.substring(0, line.lastIndexOf(".jar")) +
|
||||
"-system.jar";
|
||||
File file = new File(newline);
|
||||
if (file.isFile()) {
|
||||
if (s_log.isInfoEnabled()) {
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class TestPDLGenerator {
|
|||
HashMap map = new HashMap();
|
||||
for (Iterator iterator = files.iterator(); iterator.hasNext();) {
|
||||
String file = (String) iterator.next();
|
||||
String directory = file.substring(0, file.lastIndexOf('/'));
|
||||
String directory = file.substring(0, file.lastIndexOf(File.separator));
|
||||
List dirList = (List) map.get(directory);
|
||||
if (null == dirList) {
|
||||
dirList = new LinkedList();
|
||||
|
|
@ -125,7 +125,7 @@ public class TestPDLGenerator {
|
|||
String ddlDir = (String) options.get("-generate-ddl");
|
||||
if (ddlDir != null) {
|
||||
|
||||
String subdir = directory.substring(directory.indexOf("/com/"));
|
||||
String subdir = directory.substring(directory.indexOf(File.separator + "com" + File.separator));
|
||||
ddlDir += subdir;
|
||||
Set sqlFiles = new HashSet();
|
||||
File sqldir = (File) options.get("-sqldir");
|
||||
|
|
|
|||
|
|
@ -214,8 +214,8 @@ public class SessionStateTest extends TestCase {
|
|||
private static void exportQueryString(HttpServletDummyRequest req,
|
||||
String queryString) {
|
||||
Hashtable map = HttpUtils.parseQueryString(queryString);
|
||||
for (Enumeration enum = map.keys(); enum.hasMoreElements(); ) {
|
||||
String name = (String)enum.nextElement();
|
||||
for (Enumeration e = map.keys(); e.hasMoreElements(); ) {
|
||||
String name = (String)e.nextElement();
|
||||
String[] values = (String[])map.get(name);
|
||||
req.setParameterValues(name, values);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) Permeance Technologies Pty Ltd. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.bebop.parameters;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.event.ParameterEvent;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class URIValidationListenerTest extends TestCase {
|
||||
|
||||
public void testNull() throws FormProcessException {
|
||||
doTest(null, false);
|
||||
}
|
||||
|
||||
public void testEmpty() throws FormProcessException {
|
||||
doTest("", false);
|
||||
}
|
||||
|
||||
public void testNoProtocol() throws FormProcessException {
|
||||
doTest("a", true);
|
||||
doTest("ab", true);
|
||||
doTest("abc", true);
|
||||
doTest("abcd", true);
|
||||
doTest("abcde", true);
|
||||
}
|
||||
|
||||
public void testMissingHostname() throws FormProcessException {
|
||||
doTest("foo://", true);
|
||||
}
|
||||
|
||||
public void testRfcExamples() throws FormProcessException {
|
||||
doTest("ftp://ftp.is.co.za/rfc/rfc1808.txt", false);
|
||||
doTest("gopher://spinaltap.micro.umn.edu/00/Weather/California/Los%20Angeles", false);
|
||||
doTest("http://www.math.uio.no/faq/compression-faq/part1.html", false);
|
||||
doTest("mailto:mduerst@ifi.unizh.ch", false);
|
||||
doTest("news:comp.infosystems.www.servers.unix", false);
|
||||
doTest("telnet://melvyl.ucop.edu/", false);
|
||||
}
|
||||
|
||||
private void doTest(String value, boolean errorExpected) throws FormProcessException {
|
||||
URIValidationListener listener = new URIValidationListener();
|
||||
ParameterEvent e = new ParameterEvent(this, new ParameterData(null, value));
|
||||
assertFalse(e.getParameterData().getErrors().hasNext());
|
||||
listener.validate(e);
|
||||
if (errorExpected) {
|
||||
assertTrue(value + " should fail", e.getParameterData().getErrors().hasNext());
|
||||
} else {
|
||||
assertFalse(value + " shouldn't fail", e.getParameterData().getErrors().hasNext());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -198,7 +198,7 @@ public class CategoryTestCase extends BaseTestCase {
|
|||
}
|
||||
} else if (currentValue instanceof BigInteger) {
|
||||
test = ((BigInteger)currentValue)
|
||||
.compareTo((BigDecimal)prevValue) >= 0;
|
||||
.compareTo((BigInteger)prevValue) >= 0;
|
||||
} else if (currentValue instanceof Number) {
|
||||
test = ((Number)currentValue).longValue() >=
|
||||
((Number)prevValue).longValue();
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ import org.apache.log4j.WriterAppender;
|
|||
*/
|
||||
public class Log4jBasedTestCase extends PersistenceTestCase {
|
||||
|
||||
public static final String versionId = "$Id: Log4jBasedTestCase.java 749 2005-09-02 12:11:57Z sskracic $";
|
||||
public static final String versionId = "$Id: Log4jBasedTestCase.java 1837 2009-03-05 06:57:16Z terry $";
|
||||
|
||||
/**
|
||||
* The log object. Should be modified
|
||||
|
|
@ -92,10 +92,10 @@ public class Log4jBasedTestCase extends PersistenceTestCase {
|
|||
public void logSetUp() throws Exception {
|
||||
// nuke all priorities back to DEBUG
|
||||
Category root = Category.getRoot();
|
||||
Enumeration enum = root.getCurrentCategories();
|
||||
Enumeration e = root.getCurrentCategories();
|
||||
|
||||
while (enum.hasMoreElements()) {
|
||||
Category cat = (Category)enum.nextElement();
|
||||
while (e.hasMoreElements()) {
|
||||
Category cat = (Category)e.nextElement();
|
||||
originalPriorities.put(cat, cat.getPriority());
|
||||
cat.setPriority(Priority.DEBUG);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -314,4 +314,8 @@ public class EngineTest extends BaseTestCase {
|
|||
assertTrue(results.getCount() == 15);
|
||||
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
MetadataProviderRegistry.unregisterAdapter(Note.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,13 +19,9 @@
|
|||
package com.arsdigita.search;
|
||||
|
||||
import com.arsdigita.tools.junit.framework.BaseTestCase;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class ObserverTest extends BaseTestCase {
|
||||
|
||||
private static Logger s_log =
|
||||
Logger.getLogger(ObserverTest.class);
|
||||
|
||||
public ObserverTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
@ -66,7 +62,9 @@ public class ObserverTest extends BaseTestCase {
|
|||
// Check it disappears when deleted
|
||||
note2.delete();
|
||||
assertTrue(!TestSearchIndex.containsDocument(note2));
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
MetadataProviderRegistry.unregisterAdapter(Note.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,9 @@ package com.arsdigita.search;
|
|||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.tools.junit.framework.BaseTestCase;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class RegistryTest extends BaseTestCase {
|
||||
|
||||
private static Logger s_log =
|
||||
Logger.getLogger(RegistryTest.class);
|
||||
|
||||
public RegistryTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
|
@ -65,4 +61,8 @@ public class RegistryTest extends BaseTestCase {
|
|||
assertTrue(MetadataProviderRegistry.getAdapter(Note.BASE_DATA_OBJECT_TYPE) == null);
|
||||
assertTrue(MetadataProviderRegistry.findAdapter(Note.BASE_DATA_OBJECT_TYPE) == null);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
MetadataProviderRegistry.unregisterAdapter(Note.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,17 @@ import com.arsdigita.domain.DomainObject;
|
|||
public class TestDocumentObserver implements DocumentObserver {
|
||||
|
||||
public void onSave(DomainObject dobj) {
|
||||
MetadataProvider adapter = MetadataProviderRegistry.findAdapter(dobj.getObjectType());
|
||||
|
||||
if (adapter != null) {
|
||||
if (adapter.isIndexable(dobj)) {
|
||||
if (TestSearchIndex.containsDocument(dobj)) {
|
||||
TestSearchIndex.removeDocument(dobj);
|
||||
}
|
||||
TestSearchIndex.addDocument(dobj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onDelete(DomainObject dobj) {
|
||||
if (TestSearchIndex.containsDocument(dobj)) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public class DummyServletConfig implements ServletConfig {
|
|||
|
||||
public Enumeration getInitParameterNames() {
|
||||
final Iterator iter = m_initParameters.keySet().iterator();
|
||||
Enumeration enum = new Enumeration() {
|
||||
Enumeration e = new Enumeration() {
|
||||
public boolean hasMoreElements() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ public class DummyServletConfig implements ServletConfig {
|
|||
}
|
||||
};
|
||||
|
||||
return enum;
|
||||
return e;
|
||||
}
|
||||
|
||||
public void setInitParameter(String name, String value) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue