You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2010/01/11 20:51:04 UTC
svn commit: r898032 [2/2] - in /velocity/engine/trunk/src:
java/org/apache/velocity/ java/org/apache/velocity/context/
java/org/apache/velocity/exception/
java/org/apache/velocity/runtime/directive/
java/org/apache/velocity/runtime/parser/node/ java/or...
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity689TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity689TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity689TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity689TestCase.java Mon Jan 11 19:51:03 2010
@@ -1,76 +1,75 @@
-package org.apache.velocity.test.issues;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.VelocityContext;
-import org.apache.velocity.runtime.RuntimeConstants;
-
-/**
- * This class tests VELOCITY-689.
- */
-public class Velocity689TestCase extends BaseTestCase
-{
- public Velocity689TestCase(String name)
- {
- super(name);
- //DEBUG = true;
- }
-
- public void setUpContext(VelocityContext ctx)
- {
- ctx.put("foo", new Foo());
- }
-
- public void testIt()
- {
- String template = "$foo.baz, $foo.bar";
- assertEvalEquals("baz, bar", template);
- }
-
- public static interface HasMethod
- {
- String getBar();
- }
-
- public static interface HasOtherMethod extends HasMethod
- {
- String getBaz();
- }
-
- public static interface NoMethod extends HasOtherMethod
- {
- // nada!
- }
-
- private static class Foo implements NoMethod
- {
- public String getBar()
- {
- return "bar";
- }
-
- public String getBaz()
- {
- return "baz";
- }
- }
-
-}
+package org.apache.velocity.test.issues;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.velocity.VelocityContext;
+import org.apache.velocity.test.BaseTestCase;
+
+/**
+ * This class tests VELOCITY-689.
+ */
+public class Velocity689TestCase extends BaseTestCase
+{
+ public Velocity689TestCase(String name)
+ {
+ super(name);
+ //DEBUG = true;
+ }
+
+ public void setUpContext(VelocityContext ctx)
+ {
+ ctx.put("foo", new Foo());
+ }
+
+ public void testIt()
+ {
+ String template = "$foo.baz, $foo.bar";
+ assertEvalEquals("baz, bar", template);
+ }
+
+ public static interface HasMethod
+ {
+ String getBar();
+ }
+
+ public static interface HasOtherMethod extends HasMethod
+ {
+ String getBaz();
+ }
+
+ public static interface NoMethod extends HasOtherMethod
+ {
+ // nada!
+ }
+
+ private static class Foo implements NoMethod
+ {
+ public String getBar()
+ {
+ return "bar";
+ }
+
+ public String getBaz()
+ {
+ return "baz";
+ }
+ }
+
+}
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity701TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity701TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity701TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity701TestCase.java Mon Jan 11 19:51:03 2010
@@ -1,74 +1,71 @@
-package org.apache.velocity.test.issues;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.lang.reflect.Modifier;
-import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.test.misc.TestLogChute;
-
-/**
- * This class tests VELOCITY-701.
- */
-public class Velocity701TestCase extends BaseTestCase
-{
- public Velocity701TestCase(String name)
- {
- super(name);
- //DEBUG = true;
- }
-
- public void testAbstractClass()
- {
- context.put("foo", new Foo() {
- public String getBar() {
- return "bar";
- }
- });
- assertEvalEquals("bar", "$foo.bar");
- }
-
- public static abstract class Foo {
-
- public abstract String getBar();
-
- }
-
- /* TODO: uncomment for jdk 1.5+
- public void testEnum()
- {
- context.put("bar", Bar.ONE);
- assertEvalEquals("foo", "$bar.foo");
- }
-
- public static enum Bar {
-
- ONE(){
- public String getFoo() {
- return "foo";
- }
- };
-
- //This was an abstract method, but Velocity 1.6 quit working with it.
- public abstract String getFoo();
-
- }*/
-
-}
+package org.apache.velocity.test.issues;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.velocity.test.BaseTestCase;
+
+/**
+ * This class tests VELOCITY-701.
+ */
+public class Velocity701TestCase extends BaseTestCase
+{
+ public Velocity701TestCase(String name)
+ {
+ super(name);
+ //DEBUG = true;
+ }
+
+ public void testAbstractClass()
+ {
+ context.put("foo", new Foo() {
+ public String getBar() {
+ return "bar";
+ }
+ });
+ assertEvalEquals("bar", "$foo.bar");
+ }
+
+ public static abstract class Foo {
+
+ public abstract String getBar();
+
+ }
+
+ /* TODO: uncomment for jdk 1.5+
+ public void testEnum()
+ {
+ context.put("bar", Bar.ONE);
+ assertEvalEquals("foo", "$bar.foo");
+ }
+
+ public static enum Bar {
+
+ ONE(){
+ public String getFoo() {
+ return "foo";
+ }
+ };
+
+ //This was an abstract method, but Velocity 1.6 quit working with it.
+ public abstract String getFoo();
+
+ }*/
+
+}
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity702TestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity702TestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity702TestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/issues/Velocity702TestCase.java Mon Jan 11 19:51:03 2010
@@ -1,99 +1,98 @@
-package org.apache.velocity.test.issues;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.test.misc.TestLogChute;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.runtime.resource.loader.StringResourceLoader;
-import org.apache.velocity.runtime.resource.util.StringResourceRepository;
-
-/**
- * This class tests VELOCITY-702.
- */
-public class Velocity702TestCase extends BaseTestCase
-{
- public Velocity702TestCase(String name)
- {
- super(name);
- }
-
- public void setUpEngine(VelocityEngine engine)
- {
- engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "high,low");
- engine.addProperty("high.resource.loader.class", StringResourceLoader.class.getName());
- engine.addProperty("high.resource.loader.cache", "false");
- engine.addProperty("high.resource.loader.repository.name", "high");
- engine.addProperty("high.resource.loader.repository.static", "false");
- engine.addProperty("high.resource.loader.modificationCheckInterval", "1");
- engine.addProperty("low.resource.loader.class", StringResourceLoader.class.getName());
- engine.addProperty("low.resource.loader.cache", "true");
- engine.addProperty("low.resource.loader.repository.name", "low");
- engine.addProperty("low.resource.loader.repository.static", "false");
- engine.addProperty("low.resource.loader.modificationCheckInterval", "1");
- engine.init();
- }
-
- public void testIt() throws Exception
- {
- addToHigh("foo", "foo");
- addToLow("foo", "bar");
- assertTmplEquals("foo", "foo");
-
- removeFromHigh("foo");
- assertTmplEquals("bar", "foo");
-
- Thread.sleep(1500);
- addToHigh("foo", "woogie");
- assertTmplEquals("woogie", "foo");
- }
-
- private void addToHigh(String name, String content)
- {
- getHighRepo().putStringResource(name, content);
- }
-
- private void removeFromHigh(String name)
- {
- getHighRepo().removeStringResource(name);
- }
-
- private StringResourceRepository getHighRepo()
- {
- return (StringResourceRepository)engine.getApplicationAttribute("high");
- }
-
- private void addToLow(String name, String content)
- {
- getLowRepo().putStringResource(name, content);
- }
-
- private void removeFromLow(String name)
- {
- getLowRepo().removeStringResource(name);
- }
-
- private StringResourceRepository getLowRepo()
- {
- return (StringResourceRepository)engine.getApplicationAttribute("low");
- }
-
-}
+package org.apache.velocity.test.issues;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.resource.loader.StringResourceLoader;
+import org.apache.velocity.runtime.resource.util.StringResourceRepository;
+import org.apache.velocity.test.BaseTestCase;
+
+/**
+ * This class tests VELOCITY-702.
+ */
+public class Velocity702TestCase extends BaseTestCase
+{
+ public Velocity702TestCase(String name)
+ {
+ super(name);
+ }
+
+ public void setUpEngine(VelocityEngine engine)
+ {
+ engine.setProperty(RuntimeConstants.RESOURCE_LOADER, "high,low");
+ engine.addProperty("high.resource.loader.class", StringResourceLoader.class.getName());
+ engine.addProperty("high.resource.loader.cache", "false");
+ engine.addProperty("high.resource.loader.repository.name", "high");
+ engine.addProperty("high.resource.loader.repository.static", "false");
+ engine.addProperty("high.resource.loader.modificationCheckInterval", "1");
+ engine.addProperty("low.resource.loader.class", StringResourceLoader.class.getName());
+ engine.addProperty("low.resource.loader.cache", "true");
+ engine.addProperty("low.resource.loader.repository.name", "low");
+ engine.addProperty("low.resource.loader.repository.static", "false");
+ engine.addProperty("low.resource.loader.modificationCheckInterval", "1");
+ engine.init();
+ }
+
+ public void testIt() throws Exception
+ {
+ addToHigh("foo", "foo");
+ addToLow("foo", "bar");
+ assertTmplEquals("foo", "foo");
+
+ removeFromHigh("foo");
+ assertTmplEquals("bar", "foo");
+
+ Thread.sleep(1500);
+ addToHigh("foo", "woogie");
+ assertTmplEquals("woogie", "foo");
+ }
+
+ private void addToHigh(String name, String content)
+ {
+ getHighRepo().putStringResource(name, content);
+ }
+
+ private void removeFromHigh(String name)
+ {
+ getHighRepo().removeStringResource(name);
+ }
+
+ private StringResourceRepository getHighRepo()
+ {
+ return (StringResourceRepository)engine.getApplicationAttribute("high");
+ }
+
+ private void addToLow(String name, String content)
+ {
+ getLowRepo().putStringResource(name, content);
+ }
+
+ private void removeFromLow(String name)
+ {
+ getLowRepo().removeStringResource(name);
+ }
+
+ private StringResourceRepository getLowRepo()
+ {
+ return (StringResourceRepository)engine.getApplicationAttribute("low");
+ }
+
+}
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/sql/BaseSQLTest.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/BaseSQLTest.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/sql/BaseSQLTest.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/sql/BaseSQLTest.java Mon Jan 11 19:51:03 2010
@@ -23,8 +23,6 @@
import java.sql.SQLException;
import java.sql.Statement;
-import javax.sql.DataSource;
-
import org.apache.velocity.test.BaseTestCase;
/**
Modified: velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java?rev=898032&r1=898031&r2=898032&view=diff
==============================================================================
--- velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java (original)
+++ velocity/engine/trunk/src/test/org/apache/velocity/test/sql/DataSourceResourceLoaderTestCase.java Mon Jan 11 19:51:03 2010
@@ -35,7 +35,6 @@
import org.apache.velocity.app.Velocity;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.RuntimeSingleton;
import org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader;
import org.apache.velocity.test.misc.TestLogChute;