You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by mi...@apache.org on 2024/02/13 20:53:06 UTC
(velocity-engine) branch remove-outdated-test updated (49b46992 -> fe2cda32)
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a change to branch remove-outdated-test
in repository https://gitbox.apache.org/repos/asf/velocity-engine.git
discard 49b46992 Remove obsolete test
new fe2cda32 [VELOCITY-976] Remove obsolete VelTools66TestCase
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (49b46992)
\
N -- N -- N refs/heads/remove-outdated-test (fe2cda32)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
(velocity-engine) 01/01: [VELOCITY-976] Remove obsolete VelTools66TestCase
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
michaelo pushed a commit to branch remove-outdated-test
in repository https://gitbox.apache.org/repos/asf/velocity-engine.git
commit fe2cda32a92dfb239257ce42fea3bff4fcdeebb9
Author: Michael Osipov <mi...@apache.org>
AuthorDate: Tue Feb 13 18:03:09 2024 +0100
[VELOCITY-976] Remove obsolete VelTools66TestCase
This closes #42
---
.../velocity/test/issues/VelTools66TestCase.java | 181 ---------------------
1 file changed, 181 deletions(-)
diff --git a/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/VelTools66TestCase.java b/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/VelTools66TestCase.java
deleted file mode 100644
index 529683ff..00000000
--- a/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/VelTools66TestCase.java
+++ /dev/null
@@ -1,181 +0,0 @@
-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 junit.framework.Test;
-import junit.framework.TestSuite;
-import org.apache.velocity.app.Velocity;
-import org.apache.velocity.runtime.RuntimeInstance;
-import org.apache.velocity.test.BaseTestCase;
-import org.apache.velocity.test.misc.TestLogger;
-import org.apache.velocity.util.introspection.Introspector;
-
-import java.lang.reflect.Method;
-import java.security.AccessControlException;
-import java.security.Permission;
-
-/**
- * Test Case for <a href="https://issues.apache.org/jira/browse/VELTOOLS-66">Velocity Tools Issue 66</a>.
- */
-public class VelTools66TestCase
- extends BaseTestCase
-{
- protected static boolean DEBUG = false;
-
- public VelTools66TestCase(final String name)
- throws Exception
- {
- super(name);
- }
-
- public static Test suite()
- {
- return new TestSuite(VelTools66TestCase.class);
- }
-
- @Override
- public void setUp()
- throws Exception
- {
- Velocity.setProperty(
- Velocity.RUNTIME_LOG_INSTANCE, new TestLogger());
-
- Velocity.init();
- System.setSecurityManager(new TestSecurityManager());
-
- }
-
- protected static void log(String out)
- {
- Velocity.getLog().debug(out);
- if (DEBUG)
- {
- System.out.println(out);
- }
- }
-
- @Override
- public void tearDown()
- {
- System.setSecurityManager(null);
- }
-
- public void testVelTools66()
- throws Exception
- {
- /* the testcase is obsolete in JDK 8, as SystemManager.checkMemberAccess is not anymore called
- * by Class.getMethods() */
-
- String [] javaVersionFields = System.getProperty("java.version").split("\\.");
- int javaVersion = Integer.parseInt(javaVersionFields[0]);
- if (javaVersion == 1)
- {
- javaVersion = Integer.parseInt(javaVersionFields[1]);
- }
-
- if (javaVersion >= 8)
- {
- return;
- }
-
- Method verifyMethod = TestInterface.class.getMethod("getTestValue");
-
- RuntimeInstance ri = new RuntimeInstance();
- log = new TestLogger(false, false);
- Introspector introspector = new Introspector(log);
-
- Method testMethod = introspector.getMethod(TestObject.class, "getTestValue", new Object[0]);
- assertNotNull(testMethod);
- assertEquals("Method object does not match!", verifyMethod, testMethod);
- }
-
- public interface TestInterface
- {
- String getTestValue();
-
- void setTestValue(String testValue);
- }
-
- public static final class TestObject
- implements TestInterface
- {
- String testValue = null;
-
- public TestObject()
- {
- }
-
- @Override
- public String getTestValue()
- {
- return testValue;
- }
-
- @Override
- public void setTestValue(final String testValue)
- {
- this.testValue = testValue;
- }
- }
-
- public static final class TestSecurityManager extends SecurityManager
- {
- private final Class<?> clazz = TestObject.class;
-
- public TestSecurityManager()
- {
- super();
- }
-
- public void checkMemberAccess(final Class<?> c, final int i)
- {
- log("checkMemberAccess(" + c.getName() + ", " + i + ")");
-
- if (c.equals(clazz))
- {
- throw new AccessControlException("You are not allowed to access TestObject directly!");
- }
- }
-
- @Override
- public void checkRead(final String file)
- {
- log("checkRead(" + file + ")");
- }
-
- @Override
- public void checkPackageAccess(final String s)
- {
- log("checkPackageAccess(" + s + ")");
- }
-
- @Override
- public void checkPropertyAccess(final String s)
- {
- log("checkPropertyAccess(" + s + ")");
- }
-
- @Override
- public void checkPermission(final Permission p)
- {
- log("checkPermission(" + p + ")");
- }
- }
-}