hudson.plugins.analysis.test
Class AbstractSerializeModelTest

java.lang.Object
  extended by hudson.plugins.analysis.test.AbstractEnglishLocaleTest
      extended by hudson.plugins.analysis.test.AbstractSerializeModelTest

public abstract class AbstractSerializeModelTest
extends AbstractEnglishLocaleTest

Tests the serialization of the model.

See Also:
Testing object serialization

Field Summary
protected static String HIGH
          Task property.
protected static int LINE_NUMBER
          Task property.
protected static String LOW
          Task property.
protected static String MODULE1
          Task property.
protected static String MODULE2
          Task property.
protected static String NORMAL
          Task property.
protected static String PACKAGE1
          Task property.
protected static String PACKAGE2
          Task property.
protected static String PATH_TO_FILE1
          Task property.
protected static String PATH_TO_FILE2
          Task property.
protected static String TEST_TASK1
          Task property.
protected static String TEST_TASK2
          Task property.
protected static String TEST_TASK3
          Task property.
protected static String TEST_TASK4
          Task property.
protected static String TEST_TASK5
          Task property.
 
Constructor Summary
AbstractSerializeModelTest()
           
 
Method Summary
protected abstract  hudson.plugins.analysis.util.model.AbstractAnnotation createAnnotation(int line, String message, hudson.plugins.analysis.util.model.Priority priority, String fileName, String packageName, String moduleName)
          Creates an annotation.
protected abstract  hudson.XmlFile createXmlFile(File file)
          Creates the XML serialization file.
protected
<T> T
deserialize(String fileName)
          Creates a new object from the serialization data stored in the specified file.
protected  void ensureSerialization(String fileName)
          Verifies that the specified XML file is a valid serialization of the project.
 void testObjectIsSameAfterDeserialization()
          Test whether a serialized task is the same object after deserialization.
protected abstract  void verifyFirstAnnotation(hudson.plugins.analysis.util.model.AbstractAnnotation annotation)
          Verifies the first created annotation.
protected  void verifyFirstAnnotation(hudson.plugins.analysis.util.model.JavaProject project)
          Verifies the first annotation of the project.
protected  void verifyProject(hudson.plugins.analysis.util.model.JavaProject project)
          Verifies the created project.
 
Methods inherited from class hudson.plugins.analysis.test.AbstractEnglishLocaleTest
initializeLocale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODULE2

protected static final String MODULE2
Task property.

See Also:
Constant Field Values

MODULE1

protected static final String MODULE1
Task property.

See Also:
Constant Field Values

PACKAGE2

protected static final String PACKAGE2
Task property.

See Also:
Constant Field Values

PACKAGE1

protected static final String PACKAGE1
Task property.

See Also:
Constant Field Values

PATH_TO_FILE2

protected static final String PATH_TO_FILE2
Task property.

See Also:
Constant Field Values

PATH_TO_FILE1

protected static final String PATH_TO_FILE1
Task property.

See Also:
Constant Field Values

LOW

protected static final String LOW
Task property.

See Also:
Constant Field Values

NORMAL

protected static final String NORMAL
Task property.

See Also:
Constant Field Values

HIGH

protected static final String HIGH
Task property.

See Also:
Constant Field Values

TEST_TASK5

protected static final String TEST_TASK5
Task property.

See Also:
Constant Field Values

TEST_TASK4

protected static final String TEST_TASK4
Task property.

See Also:
Constant Field Values

TEST_TASK3

protected static final String TEST_TASK3
Task property.

See Also:
Constant Field Values

TEST_TASK2

protected static final String TEST_TASK2
Task property.

See Also:
Constant Field Values

TEST_TASK1

protected static final String TEST_TASK1
Task property.

See Also:
Constant Field Values

LINE_NUMBER

protected static final int LINE_NUMBER
Task property.

See Also:
Constant Field Values
Constructor Detail

AbstractSerializeModelTest

public AbstractSerializeModelTest()
Method Detail

deserialize

protected <T> T deserialize(String fileName)
Creates a new object from the serialization data stored in the specified file.

Type Parameters:
T - type of object
Parameters:
fileName - the file to get the data from
Returns:
the deserialized object

verifyFirstAnnotation

protected void verifyFirstAnnotation(hudson.plugins.analysis.util.model.JavaProject project)
Verifies the first annotation of the project.

Parameters:
project - the created project

verifyFirstAnnotation

protected abstract void verifyFirstAnnotation(hudson.plugins.analysis.util.model.AbstractAnnotation annotation)
Verifies the first created annotation.

Parameters:
annotation - the first created annotation

createAnnotation

protected abstract hudson.plugins.analysis.util.model.AbstractAnnotation createAnnotation(int line,
                                                                                          String message,
                                                                                          hudson.plugins.analysis.util.model.Priority priority,
                                                                                          String fileName,
                                                                                          String packageName,
                                                                                          String moduleName)
Creates an annotation.

Parameters:
line - the line
message - the message
priority - the priority
fileName - the file name
packageName - the package name
moduleName - the module name
Returns:
the annotation

testObjectIsSameAfterDeserialization

public void testObjectIsSameAfterDeserialization()
                                          throws Exception
Test whether a serialized task is the same object after deserialization.

Throws:
Exception - Signals a test failure

createXmlFile

protected abstract hudson.XmlFile createXmlFile(File file)
Creates the XML serialization file.

Parameters:
file - the file for the XML data
Returns:
the XML serialization file

verifyProject

protected void verifyProject(hudson.plugins.analysis.util.model.JavaProject project)
Verifies the created project.

Parameters:
project - the created project

ensureSerialization

protected void ensureSerialization(String fileName)
Verifies that the specified XML file is a valid serialization of the project.

Parameters:
fileName - the file name


Copyright © 2004-2012. All Rights Reserved.