You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tdk-dev@turbine.apache.org by kn...@apache.org on 2001/08/10 14:18:03 UTC
cvs commit: jakarta-turbine-tdk/src/src/test/org/apache/turbine/test TestLogin.java
knielsen 01/08/10 05:18:03
Modified: src/share/sample/src/java/modules/actions SQL.java
SecureAction.java
src/share/sample/src/java/modules/screens Form.java
Index.java SecureScreen.java
src/share/sample/src/java/modules/tags UserInfoTag.java
src/share/sample30/src/java/modules/actions SendMail.java
src/share/sample30/src/java/modules/screens BSF.java
src/src/java/org/apache/turbine/tools ImportStatements.java
Migrator.java
src/src/test/org/apache/turbine/test TestLogin.java
Log:
adding license and removing trailing spaces
Revision Changes Path
1.2 +5 -5 jakarta-turbine-tdk/src/share/sample/src/java/modules/actions/SQL.java
Index: SQL.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample/src/java/modules/actions/SQL.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SQL.java 2001/05/27 22:35:33 1.1
+++ SQL.java 2001/08/10 12:18:02 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -86,7 +86,7 @@
data.getParameters().setProperties(entry);
entry.save();
}
-
+
/**
* Update a record in the database with the
* information present in the web form.
1.2 +7 -7 jakarta-turbine-tdk/src/share/sample/src/java/modules/actions/SecureAction.java
Index: SecureAction.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample/src/java/modules/actions/SecureAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SecureAction.java 2001/05/27 22:35:33 1.1
+++ SecureAction.java 2001/08/10 12:18:02 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -98,12 +98,12 @@
protected boolean isAuthorized( RunData data ) throws Exception
{
boolean isAuthorized = false;
-
- /*
+
+ /*
* Get acl and check security.
*/
AccessControlList acl = data.getACL();
-
+
//if (acl == null || ! acl.hasPermission("default_view", "group"))
if (acl == null || ! acl.hasRole("turbine_root"))
{
1.2 +5 -5 jakarta-turbine-tdk/src/share/sample/src/java/modules/screens/Form.java
Index: Form.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample/src/java/modules/screens/Form.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Form.java 2001/05/27 22:35:33 1.1
+++ Form.java 2001/08/10 12:18:02 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -87,7 +87,7 @@
Criteria criteria = new Criteria();
criteria.add(RdfPeer.RDF_ID, entry_id);
Rdf rdf = (Rdf) RdfPeer.doSelect(criteria).elementAt(0);
- context.put("entry", rdf);
+ context.put("entry", rdf);
}
catch (Exception e)
{
1.2 +4 -4 jakarta-turbine-tdk/src/share/sample/src/java/modules/screens/Index.java
Index: Index.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample/src/java/modules/screens/Index.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Index.java 2001/05/27 22:35:33 1.1
+++ Index.java 2001/08/10 12:18:02 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1.3 +6 -6 jakarta-turbine-tdk/src/share/sample/src/java/modules/screens/SecureScreen.java
Index: SecureScreen.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample/src/java/modules/screens/SecureScreen.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SecureScreen.java 2001/05/31 22:01:42 1.2
+++ SecureScreen.java 2001/08/10 12:18:02 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -88,12 +88,12 @@
boolean isAuthorized = false;
AccessControlList acl = data.getACL();
-
+
if (acl==null || ! acl.hasRole("turbine_root"))
{
data.setScreenTemplate(
TurbineResources.getString("template.login"));
-
+
isAuthorized = false;
}
else if(acl.hasRole("turbine_root"))
1.2 +108 -54 jakarta-turbine-tdk/src/share/sample/src/java/modules/tags/UserInfoTag.java
Index: UserInfoTag.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample/src/java/modules/tags/UserInfoTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UserInfoTag.java 2001/05/27 22:35:34 1.1
+++ UserInfoTag.java 2001/08/10 12:18:02 1.2
@@ -1,54 +1,108 @@
-package @TARGET_PACKAGE@.tags;
-
-import java.io.IOException;
-
-import javax.servlet.jsp.tagext.TagSupport;
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-
-import org.apache.turbine.util.RunData;
-import org.apache.turbine.services.jsp.JspService;
-import org.apache.turbine.om.security.User;
-
-/**
- * UserInfoTag is a sample JSP tag handler that displays the full
- * name of the user that is currently logged in.
- */
-
-public class UserInfoTag extends TagSupport
-{
- /**
- * Process the StartTag event
- *
- * @exception JspException
- */
-
- public int doStartTag() throws JspException
- {
-
- // Get the Turbine "RunData" object that was stuffed into the Http request.
-
- RunData data = (RunData)pageContext.getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE);
-
- // If we have a RunData object, get the User object
-
- if (data != null)
- {
- User user = data.getUser();
-
- // Write out the user's full name (last name, first name)
-
- try
- {
- String fullName = user.getFirstName() + " " + user.getLastName();
- pageContext.getOut().print(fullName);
- }
- catch (IOException e)
- {
- throw new JspException("I/O Exception: " + e.getMessage());
- }
- }
-
- return SKIP_BODY;
- }
-}
+package @TARGET_PACKAGE@.tags;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Turbine", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.IOException;
+
+import javax.servlet.jsp.tagext.TagSupport;
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+import org.apache.turbine.util.RunData;
+import org.apache.turbine.services.jsp.JspService;
+import org.apache.turbine.om.security.User;
+
+/**
+ * UserInfoTag is a sample JSP tag handler that displays the full
+ * name of the user that is currently logged in.
+ */
+
+public class UserInfoTag extends TagSupport
+{
+ /**
+ * Process the StartTag event
+ *
+ * @exception JspException
+ */
+
+ public int doStartTag() throws JspException
+ {
+
+ // Get the Turbine "RunData" object that was stuffed into the Http request.
+
+ RunData data = (RunData)pageContext.getAttribute(JspService.RUNDATA, PageContext.REQUEST_SCOPE);
+
+ // If we have a RunData object, get the User object
+
+ if (data != null)
+ {
+ User user = data.getUser();
+
+ // Write out the user's full name (last name, first name)
+
+ try
+ {
+ String fullName = user.getFirstName() + " " + user.getLastName();
+ pageContext.getOut().print(fullName);
+ }
+ catch (IOException e)
+ {
+ throw new JspException("I/O Exception: " + e.getMessage());
+ }
+ }
+
+ return SKIP_BODY;
+ }
+}
1.2 +4 -4 jakarta-turbine-tdk/src/share/sample30/src/java/modules/actions/SendMail.java
Index: SendMail.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample30/src/java/modules/actions/SendMail.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SendMail.java 2001/07/25 01:08:06 1.1
+++ SendMail.java 2001/08/10 12:18:02 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
1.3 +6 -6 jakarta-turbine-tdk/src/share/sample30/src/java/modules/screens/BSF.java
Index: BSF.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/share/sample30/src/java/modules/screens/BSF.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BSF.java 2001/08/01 15:40:27 1.2
+++ BSF.java 2001/08/10 12:18:02 1.3
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -65,7 +65,7 @@
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
*/
-public class BSF
+public class BSF
extends SecureScreen
{
/**
@@ -74,6 +74,6 @@
*/
public void doBuildTemplate( RunData data, TemplateContext context )
{
- TurbineBSF.execute("helloWorld");
+ TurbineBSF.execute("helloWorld");
}
}
1.2 +121 -67 jakarta-turbine-tdk/src/src/java/org/apache/turbine/tools/ImportStatements.java
Index: ImportStatements.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/src/java/org/apache/turbine/tools/ImportStatements.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ImportStatements.java 2001/06/20 20:33:01 1.1
+++ ImportStatements.java 2001/08/10 12:18:02 1.2
@@ -1,5 +1,59 @@
package org.apache.turbine.tools;
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Turbine", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
import de.fub.bytecode.Repository;
import de.fub.bytecode.classfile.ClassParser;
import de.fub.bytecode.classfile.Code;
@@ -67,29 +121,29 @@
{
execute(className);
}
-
+
public void execute(String className)
{
Hashtable classes = new Hashtable();
-
+
try
{
TreeMap classNames = new TreeMap();
classNames.putAll(classReferences(className));
classNames.putAll(localVariables(className));
-
+
/*
* Don't need reference to the class
* being analysed.
*/
- classNames.remove(className);
-
+ classNames.remove(className);
+
Iterator iterator = classNames.values().iterator();
StringBuffer sb = new StringBuffer();
while (iterator.hasNext())
{
String signature = (String) iterator.next();
-
+
/*
* Get rid of imports that are of the form
* import java.lang.X;
@@ -99,26 +153,26 @@
if (signature.substring("java.lang.".length()).indexOf(".") == -1)
{
continue;
- }
+ }
}
-
+
if (basePackage(className).equals(basePackage(signature)))
{
continue;
- }
-
+ }
+
/*
* We also need to get rid of imports for classes
* in the same package as the class being
* analysed.
*/
-
+
sb.append("import ")
.append(signature)
.append(";")
.append("\n");
- }
-
+ }
+
System.out.println(sb);
}
catch(Exception e)
@@ -139,21 +193,21 @@
* @param String className
* @return Hashtable Fully qualified class references.
*/
- public static Hashtable classReferences(String className)
+ public static Hashtable classReferences(String className)
throws Exception
{
JavaClass javaClass;
-
+
if ((javaClass = Repository.lookupClass(className)) == null)
{
javaClass = new ClassParser(className).parse();
- }
-
+ }
+
ConstantPool constantPool = javaClass.getConstantPool();
-
+
return processConstantPool(constantPool);
}
-
+
/**
* Determine the class references in a constant pool.
*
@@ -166,34 +220,34 @@
Constant[] constantPoolArray = constantPool.getConstantPool();
String signature;
int index;
-
+
for (int i = 0; i < constantPoolArray.length; i++)
{
if (constantPoolArray[i] instanceof ConstantClass)
{
- index = ((ConstantClass)
+ index = ((ConstantClass)
constantPoolArray[i]).getNameIndex();
-
- ConstantUtf8 constant = (ConstantUtf8)
+
+ ConstantUtf8 constant = (ConstantUtf8)
constantPool.getConstant(index);
-
+
signature = new String(constant.getBytes());
signature = signature.replace('/', '.');
-
+
if (signature.startsWith("L") && signature.endsWith(";"))
{
/*
* Reference of the form Ljava.util.Hashtable;
*/
signature = signature.substring(1,signature.length()-1);
- }
+ }
else if (signature.startsWith("[L") && signature.endsWith(";"))
{
/*
* Reference of the form Ljava.util.Hashtable;
*/
signature = signature.substring(2,signature.length()-1);
- }
+ }
else if (signature.startsWith("["))
{
continue;
@@ -201,13 +255,13 @@
else if (signature.indexOf("$") != -1)
{
continue;
- }
-
+ }
+
if (signature.endsWith("[]"))
{
signature = signature.substring(0, signature.length()-2);
- }
-
+ }
+
classReferences.put(signature,signature);
}
@@ -215,13 +269,13 @@
{
index = ((ConstantCP)
constantPoolArray[i]).getNameAndTypeIndex();
-
+
ConstantNameAndType ntConstant = (ConstantNameAndType)
constantPool.getConstant(index);
-
+
index = ntConstant.getSignatureIndex();
- ConstantUtf8 constant = (ConstantUtf8)
+ ConstantUtf8 constant = (ConstantUtf8)
constantPool.getConstant(index);
signature = new String(constant.getBytes());
@@ -231,19 +285,19 @@
if (returnType.endsWith("[]"))
{
returnType = returnType.substring(0, returnType.length()-2);
- }
-
+ }
+
if (returnType.indexOf("$") == -1)
{
classReferences.put(returnType,returnType);
- }
- }
+ }
+ }
if (constantPoolArray[i] instanceof ConstantMethodref ||
constantPoolArray[i] instanceof ConstantInterfaceMethodref)
{
String[] argumentTypes = Utility.methodSignatureArgumentTypes(signature);
-
+
for (int j = 0; j < argumentTypes.length; j++)
{
String argType = argumentTypes[j];
@@ -252,20 +306,20 @@
if (argType.endsWith("[]"))
{
argType = argType.substring(0, argType.length()-2);
- }
+ }
if (argType.indexOf("$") == -1)
{
classReferences.put(argType,argType);
- }
- }
+ }
+ }
}
}
}
}
-
+
return classReferences;
}
-
+
/**
* Find all the local variable references within a method.
*
@@ -275,44 +329,44 @@
public static Hashtable localVariables(String name) throws Exception
{
Hashtable vars = new Hashtable();
-
+
JavaClass javaClass;
-
+
if ((javaClass = Repository.lookupClass(name)) == null)
{
javaClass = new ClassParser(name).parse();
- }
-
+ }
+
Method[] methods = javaClass.getMethods();
-
+
for (int i = 0; i < methods.length; i++)
{
Code code = methods[i].getCode();
if (code != null)
{
LocalVariableTable table = code.getLocalVariableTable();
-
+
if (table == null)
{
continue;
- }
-
+ }
+
LocalVariable[] lvt = table.getLocalVariableTable();
-
+
for (int j = 0; j < lvt.length; j++)
{
String lvar = Utility.signatureToString(lvt[j].getSignature());
-
+
if (lvar.indexOf(".") == -1)
{
continue;
- }
-
+ }
+
if (lvar.indexOf("$") != -1)
{
continue;
- }
-
+ }
+
/*
* Get rid of the array signature
* if present we just need the base type
@@ -321,21 +375,21 @@
if (lvar.endsWith("[]"))
{
lvar = lvar.substring(0, lvar.length() - 2);
- }
-
+ }
+
vars.put(lvar,lvar);
-
- /*
+
+ /*
* Process the constant pool of the method.
*/
- Hashtable methodClassReferences =
+ Hashtable methodClassReferences =
processConstantPool(code.getConstantPool());
-
+
vars.putAll(methodClassReferences);
- }
- }
+ }
+ }
}
-
+
return vars;
}
1.2 +35 -35 jakarta-turbine-tdk/src/src/java/org/apache/turbine/tools/Migrator.java
Index: Migrator.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/src/java/org/apache/turbine/tools/Migrator.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Migrator.java 2001/06/20 20:31:33 1.1
+++ Migrator.java 2001/08/10 12:18:02 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -69,8 +69,8 @@
* releases of Turbine.
*
* @author <a href="mailto:jvanzyl@periapt.com">Jason van Zyl</a>
- *
- * @version $Id: Migrator.java,v 1.1 2001/06/20 20:31:33 jvanzyl Exp $
+ *
+ * @version $Id: Migrator.java,v 1.2 2001/08/10 12:18:02 knielsen Exp $
*/
public class Migrator
{
@@ -80,15 +80,15 @@
protected String originalSourceFile;
/**
- * Regular expression tool
+ * Regular expression tool
*/
protected Perl5Util perl;
-
- /**
- * Path separator property
+
+ /**
+ * Path separator property
*/
protected String pathSeparator = File.separator;
-
+
/*
* The regexes to use for substition. The regexes come
* in pairs. The first is the string to match, the
@@ -123,7 +123,7 @@
// possibility of javascript.
"\n}", // assumes that javascript is indented, WMs not!!!
"\n#end",
-
+
// Convert WM style #set to Velocity directive style.
"#set\\s+(\\$[^\\s=]+)\\s*=\\s*(.*\\S)[ \\t]*",
"#set( $1 = $2 )",
@@ -149,12 +149,12 @@
"$l_",
"\\${(_[^}]+)}", // within a formal reference
"${l$1}",
-
+
// Change extensions when seen.
"\\.wm",
".vm"
};
-
+
/**
* Iterate through the set of find/replace regexes
* that will convert a given source tree from one
@@ -164,33 +164,33 @@
if (args.length < 1)
{
usage();
- }
-
+ }
+
File file = new File(args[0]);
-
+
if (!file.exists())
{
System.err.println(
"The specified template or directory does not exist");
-
+
System.exit(1);
}
-
+
if (file.isDirectory())
{
String basedir = args[0];
String newBasedir = basedir + ".new";
-
+
DirectoryScanner ds = new DirectoryScanner();
ds.setBasedir(basedir);
ds.addDefaultExcludes();
ds.scan();
String[] files = ds.getIncludedFiles();
-
+
for (int i = 0; i < files.length; i++)
{
writeSource(files[i], basedir, newBasedir);
- }
+ }
}
else
{
@@ -205,36 +205,36 @@
private boolean writeSource(String file, String basedir, String newBasedir)
{
System.out.println("Converting " + file + "...");
-
+
String sourceFile;
String sourceDir;
String newSourceFile;
File outputDirectory;
-
+
if (basedir.length() == 0)
{
sourceFile = file;
sourceDir = "";
newSourceFile = file;
- }
+ }
else
{
sourceFile = basedir + pathSeparator + file;
- sourceDir = newBasedir + pathSeparator +
+ sourceDir = newBasedir + pathSeparator +
file.substring(0, file.lastIndexOf(pathSeparator));
-
+
outputDirectory = new File(sourceDir);
-
+
if (! outputDirectory.exists())
{
outputDirectory.mkdirs();
- }
-
+ }
+
newSourceFile = newBasedir + pathSeparator + file;
- }
-
+ }
+
String convertedSourceFile = convertSourceFile(sourceFile);
-
+
try
{
FileWriter fw = new FileWriter(newSourceFile);
@@ -245,7 +245,7 @@
{
e.printStackTrace();
}
-
+
return true;
}
@@ -276,7 +276,7 @@
if ( !originalSourceFile.endsWith("\n") )
{
originalSourceFile += "\n";
- }
+ }
perl = new Perl5Util();
for (int i = 0; i < res.length; i += 2)
1.2 +33 -33 jakarta-turbine-tdk/src/src/test/org/apache/turbine/test/TestLogin.java
Index: TestLogin.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-tdk/src/src/test/org/apache/turbine/test/TestLogin.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestLogin.java 2001/07/17 17:50:47 1.1
+++ TestLogin.java 2001/08/10 12:18:03 1.2
@@ -25,13 +25,13 @@
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Turbine" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Turbine" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
- * "Apache Turbine", nor may "Apache" appear in their name, without
+ * "Apache Turbine", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
@@ -68,8 +68,8 @@
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @see LoginUser
*/
-public class TestLogin
- extends ServletTestCase
+public class TestLogin
+ extends ServletTestCase
{
/**
* Defines the testcase name for JUnit.
@@ -80,96 +80,96 @@
{
super( name );
}
-
+
/**
* Start the tests.
*
* @param args the arguments. Not used
*/
- public static void main ( String[] args )
+ public static void main ( String[] args )
{
- junit.ui.TestRunner.main (
+ junit.ui.TestRunner.main (
new String[] { TestLogin.class.getName () } );
}
-
+
/**
* Creates the test suite.
*
* @return a test suite (<code>TestSuite</code>) that includes all methods
* starting with "test"
*/
- public static Test suite ()
+ public static Test suite ()
{
// All methods starting with "test" will be executed in the test suite.
return new TestSuite ( TestLogin.class );
}
-
+
/**
* Sets up the test case.
*
*/
- protected void setUp ()
- throws Exception
+ protected void setUp ()
+ throws Exception
{
// Create the RunData object to be used during testing.
data = RunDataFactory.getRunData ( request, response, config );
}
-
+
/**
* Tests if an invalid user is logged in correctly.
*
*/
- public void testLoginInvalidUser ()
- throws Exception
- {
+ public void testLoginInvalidUser ()
+ throws Exception
+ {
// Shouldn't have a user object available at this stage.
assertNull ( "User should be 'null' since we have not logged in " +
"yet - data.getUser () ", data.getUser () );
-
+
// Add parameters to the RunData that will be used to login a non existent user.
data.getParameters ().setString ( "username", "" );
data.getParameters ().setString ( "password", "" );
-
+
// Execute the login action.
// We need to get the login action from the TRP so this
// will work generally for all apps.
Turbine.getModuleLoader().getModule(Turbine.ACTIONS, "LoginUser").exec(data);
-
+
// See if we can find a user object.
assertNotNull ( "User object not found in RunData - runData.getUser () ",
data.getUser () );
-
+
// Since the user does not exist, the login should have failed.
assertEquals ( "Logged in - data.getUser ().hasLoggedIn ()",
- false, data.getUser ().hasLoggedIn () );
+ false, data.getUser ().hasLoggedIn () );
}
-
+
/**
* Tests if a valid user is logged in correctly.
*
*/
- public void testLoginValidUser ()
- throws Exception
- {
+ public void testLoginValidUser ()
+ throws Exception
+ {
// Shouldn't have a user object available at this stage.
assertNull ( "User should be 'null' since we have not logged in " +
"yet - data.getUser () ", data.getUser () );
-
+
// Add parameters to the RunData that will be used to login a valid user.
data.getParameters ().setString ( "username", "turbine" );
data.getParameters ().setString ( "password", "turbine" );
-
+
// Execute the login action.
ActionLoader.getInstance ().exec ( data, "JLoginUser" );
-
+
// See if we can find a user object.
assertNotNull ( "User object not found in data - data.getUser () ",
data.getUser () );
-
+
// Since we know the user exists, the login should have been successful/
assertEquals ( "Not logged in - data.getUser ().hasLoggedIn ()",
- true, data.getUser ().hasLoggedIn () );
+ true, data.getUser ().hasLoggedIn () );
}
-
+
private RunData data = null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-tdk-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-tdk-dev-help@jakarta.apache.org