1. /*
  2. * Copyright 2000-2002,2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant.taskdefs.optional.junit;
  18. import java.io.File;
  19. import java.util.Vector;
  20. /**
  21. * Baseclass for BatchTest and JUnitTest.
  22. *
  23. */
  24. public abstract class BaseTest {
  25. protected boolean haltOnError = false;
  26. protected boolean haltOnFail = false;
  27. protected boolean filtertrace = true;
  28. protected boolean fork = false;
  29. protected String ifProperty = null;
  30. protected String unlessProperty = null;
  31. protected Vector formatters = new Vector();
  32. /** destination directory */
  33. protected File destDir = null;
  34. protected String failureProperty;
  35. protected String errorProperty;
  36. public void setFiltertrace(boolean value) {
  37. filtertrace = value;
  38. }
  39. public boolean getFiltertrace() {
  40. return filtertrace;
  41. }
  42. public void setFork(boolean value) {
  43. fork = value;
  44. }
  45. public boolean getFork() {
  46. return fork;
  47. }
  48. public void setHaltonerror(boolean value) {
  49. haltOnError = value;
  50. }
  51. public void setHaltonfailure(boolean value) {
  52. haltOnFail = value;
  53. }
  54. public boolean getHaltonerror() {
  55. return haltOnError;
  56. }
  57. public boolean getHaltonfailure() {
  58. return haltOnFail;
  59. }
  60. public void setIf(String propertyName) {
  61. ifProperty = propertyName;
  62. }
  63. public void setUnless(String propertyName) {
  64. unlessProperty = propertyName;
  65. }
  66. public void addFormatter(FormatterElement elem) {
  67. formatters.addElement(elem);
  68. }
  69. /**
  70. * Sets the destination directory.
  71. */
  72. public void setTodir(File destDir) {
  73. this.destDir = destDir;
  74. }
  75. /**
  76. * @return the destination directory as an absolute path if it exists
  77. * otherwise return <tt>null</tt>
  78. */
  79. public String getTodir() {
  80. if (destDir != null) {
  81. return destDir.getAbsolutePath();
  82. }
  83. return null;
  84. }
  85. public java.lang.String getFailureProperty() {
  86. return failureProperty;
  87. }
  88. public void setFailureProperty(String failureProperty) {
  89. this.failureProperty = failureProperty;
  90. }
  91. public java.lang.String getErrorProperty() {
  92. return errorProperty;
  93. }
  94. public void setErrorProperty(String errorProperty) {
  95. this.errorProperty = errorProperty;
  96. }
  97. }