| /* |
| * Copyright (c) 1998, 2021 Oracle and/or its affiliates. All rights reserved. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0, |
| * or the Eclipse Distribution License v. 1.0 which is available at |
| * http://www.eclipse.org/org/documents/edl-v10.php. |
| * |
| * SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause |
| */ |
| |
| // Contributors: |
| // Oracle - initial API and implementation from Oracle TopLink |
| package org.eclipse.persistence.testing.framework; |
| |
| import org.eclipse.persistence.logging.SessionLog; |
| |
| /** |
| * <p><b>Purpose</b>:All the test cases are subclassed from this class. Each test case tests single |
| * feature of TopLink. Ideally a test case consists of five steps. |
| * Setup: Performs all the initial setup that is required by the test, such as setting |
| * up database to some state on which test would run. |
| * Test: The actual test to be performed, such as writing an object. |
| * Verify: Verify the test if it was performed well or not. |
| * Reset: Reset the database to the state from where the test started |
| * Reset Verify: Check if reset performed well or not. |
| */ |
| public abstract class ManualVerifyTestCase extends TestCase { |
| |
| /** |
| * Executes this test case. |
| */ |
| @Override |
| public void execute(TestExecutor executor) { |
| setTestResult(new TestResult(this, "You decide")); |
| setExecutor(executor); |
| boolean handleErrors = getExecutor().shouldHandleErrors(); |
| int logLevel = getSession().getLogLevel(); |
| |
| try { |
| setup(); |
| |
| getSession().setLogLevel(SessionLog.FINEST); |
| getExecutor().doNotHandleErrors(); |
| |
| test(); |
| |
| getSession().setLogLevel(logLevel); |
| |
| reset(); |
| resetVerify(); |
| } catch (Throwable runtimeException) { |
| TestErrorException EclipseLinkException = new TestErrorException("Error occurred.", runtimeException); |
| setTestException(EclipseLinkException); |
| throw EclipseLinkException; |
| } |
| getExecutor().setShouldHandleErrors(handleErrors); |
| } |
| } |