actualOptions, String transformName, NodeRef sourceNodeRef)
{
String sourceMimetype = reader.getMimetype();
if (sourceMimetype.equals(TEST_FAILING_MIME_TYPE))
{
throw new ContentServiceTransientException("Transformation intentionally failed for test purposes.");
}
else if (sourceMimetype.equals(TEST_LONG_RUNNING_MIME_TYPE))
{
try
{
Thread.sleep(TEST_LONG_RUNNING_TRANSFORM_TIME);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
writer.putContent("SUCCESS");
}
else
{
delegate.transform(reader, writer, actualOptions, transformName, sourceNodeRef);
}
}
@Override
public String getName()
{
return delegate.getName();
}
}
/**
* Defines the work to be done while long running transformations are being performed
* and the means to verify that work completed successfully.
*
* Implementations might update a property then verify the updated value for example.
*/
private interface LongRunningConcurrentWork
{
public void run(NodeRef source) throws Exception;
public void verify(NodeRef source) throws Exception;
}
/**
* Implementation of LongRunningConcurrentWork that does nothing
*/
private class EmptyLongRunningConcurrentWork implements LongRunningConcurrentWork
{
@Override
public void run(NodeRef source) throws Exception { }
@Override
public void verify(NodeRef source) throws Exception { }
}
private boolean shouldTestBeSkippedForCurrentDB()
{
Dialect dialect = (Dialect) applicationContext.getBean("dialect");
return dialect instanceof Oracle9Dialect ||
dialect instanceof SQLServerDialect;
}
}