Package net.officefloor.polyglot.test
Class AbstractPolyglotProcedureTest
- java.lang.Object
-
- junit.framework.Assert
-
- junit.framework.TestCase
-
- net.officefloor.frame.test.OfficeFrameTestCase
-
- net.officefloor.polyglot.test.AbstractPolyglotProcedureTest
-
- All Implemented Interfaces:
junit.framework.Test
public abstract class AbstractPolyglotProcedureTest extends OfficeFrameTestCase
Abstract tests for a polyglotProcedure
via aSectionSource
.- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractPolyglotProcedureTest.CollectionReturn
static class
AbstractPolyglotProcedureTest.FlowHandlers
static class
AbstractPolyglotProcedureTest.ObjectReturn
static class
AbstractPolyglotProcedureTest.ParameterPass
static class
AbstractPolyglotProcedureTest.ParameterReturn
static class
AbstractPolyglotProcedureTest.PrimitiveReturn
protected static interface
AbstractPolyglotProcedureTest.ProcedureBuilder
Builds theProcedure
.static class
AbstractPolyglotProcedureTest.VariablePass
static class
AbstractPolyglotProcedureTest.VariableReturn
-
Nested classes/interfaces inherited from class net.officefloor.frame.test.OfficeFrameTestCase
OfficeFrameTestCase.FailOperation, OfficeFrameTestCase.GuiTest, OfficeFrameTestCase.MultithreadedTestLogic<T extends java.lang.Throwable>, OfficeFrameTestCase.StressTest, OfficeFrameTestCase.TestCapture<T extends java.lang.Throwable>, OfficeFrameTestCase.TestLogic<R,T extends java.lang.Throwable>, OfficeFrameTestCase.UsesDockerTest, OfficeFrameTestCase.UsesGCloudTest, OfficeFrameTestCase.WaitForTruePredicate<T extends java.lang.Throwable>
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.fasterxml.jackson.databind.ObjectMapper
mapper
ObjectMapper
.protected OfficeFloor
officeFloor
-
Fields inherited from class net.officefloor.frame.test.OfficeFrameTestCase
CLASS_LOADER_EXTRA_CLASS_NAME, CLASS_LOADER_EXTRA_PACKAGE_NAME, classLoaderTestSupport, END_OF_LINE, fileTestSupport, logTestSupport, mockTestSupport, threadedTestSupport
-
-
Constructor Summary
Constructors Constructor Description AbstractPolyglotProcedureTest()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected OfficeSection
addProcedure(java.lang.String resourceName, java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory, java.lang.String procedureName, boolean isNext, PropertyList properties, CompileOfficeContext context)
Convenience method to add aProcedure
.protected java.lang.String
asynchronousFlow(CompileOfficeContext context)
protected abstract void
asynchronousFlow(AsynchronousFlow flowOne, AsynchronousFlow flowTwo)
protected abstract void
asynchronousFlow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected abstract CollectionTypes
collections(java.util.List<java.lang.Integer> list, java.util.Set<java.lang.Character> set, java.util.Map<java.lang.String,JavaObject> map)
protected java.lang.String
collections(CompileOfficeContext context, OfficeSectionInput handleResult)
protected abstract void
collections(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected java.lang.String
flow(CompileOfficeContext context, OfficeSectionInput next, OfficeSectionInput flow, OfficeSectionInput flowWithCallback, OfficeSectionInput flowWithParameterAndCallback, OfficeSectionInput flowWithParameter, OfficeSectionInput exception)
protected abstract void
flow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected abstract java.lang.Class<? extends ProcedureSourceServiceFactory>
getProcedureSourceServiceFactoryClass()
Obtains theProcedureSourceServiceFactory
Class
.protected java.lang.String
getSourceName(java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory)
Obtains the source name for theProcedureSourceServiceFactory
.protected abstract void
httpException()
protected void
httpException(OfficeFlowSourceNode pass, CompileWebContext context)
protected abstract void
httpException(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected boolean
isSupportExceptions()
Some languages do not provide exceptions.protected abstract ObjectTypes
objects(java.lang.String string, JavaObject object, int[] primitiveArray, JavaObject[] objectArray)
protected java.lang.String
objects(CompileOfficeContext context, OfficeSectionInput handleResult)
protected abstract void
objects(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected abstract ParameterTypes
parameter(java.lang.String parameter)
protected void
parameter(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)
protected abstract void
parameter(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected abstract PrimitiveTypes
primitives(boolean _boolean, byte _byte, short _short, char _char, int _int, long _long, float _float, double _double)
protected java.lang.String
primitives(CompileOfficeContext context, OfficeSectionInput handleResult)
protected abstract void
primitives(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected void
tearDown()
void
testAsynchronousFlowType()
Ensure correctProcedureType
.void
testCollectionsType()
Ensure correctProcedureType
.void
testDirectAsynchronousFlow()
Validate directAsynchronousFlow
.void
testDirectCollections()
Ensure can pass collections.void
testDirectHttpException()
Ensure can run direct forHttpException
.void
testDirectMultiThreaded()
Ensure safe to run directly multi-threaded.void
testDirectObject()
Ensure can pass in a Java object.void
testDirectParameter()
Ensure can provideParameter
.void
testDirectPrimitives()
Ensure can use primitive types.void
testDirectVariables()
Ensure can handle variables.void
testDirectWeb()
Ensure can run direct for web.void
testFlow()
Ensure can invoke flow.void
testFlowType()
Ensure correctProcedureType
.void
testHttpExceptionType()
Ensure correctProcedureType
.void
testInvokeAsynchronousFlow()
Ensure can invokeAsynchronousFlow
.void
testInvokeCollections()
Ensure can invoke collections.void
testInvokeHttpException()
Ensure can invoke to handleHttpException
.void
testInvokeMultiThreaded()
Ensure safe to run invoked multi-threaded.void
testInvokeObject()
Ensure can invoke object types.void
testInvokeParameter()
Ensure can use parameter.void
testInvokePrimitives()
Ensure can invoke primitive types.void
testInvokeVariables()
Ensure can using variables.void
testInvokeWeb()
Ensure can invoke for web.void
testObjectType()
Ensure correctProcedureType
.void
testParameterType()
Ensure correctProcedureType
.void
testPrimitivesType()
Ensure correctProcedureType
.void
testVariablesType()
Ensure correctProcedureType
.protected abstract VariableTypes
variables(char val, In<java.lang.String> in, Out<JavaObject> out, Var<java.lang.Integer> var)
protected void
variables(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)
protected abstract void
variables(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
protected abstract void
web(java.lang.String pathParameter, java.lang.String queryParameter, java.lang.String headerParameter, java.lang.String cookieParameter, MockHttpParameters httpParameters, MockHttpObject httpObject, ObjectResponse<WebTypes> response)
protected void
web(OfficeFlowSourceNode pass, CompileWebContext context)
protected abstract void
web(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
Methods inherited from class net.officefloor.frame.test.OfficeFrameTestCase
assertContents, assertContents, assertFail, assertFail, assertFail, assertGraph, assertList, assertList, assertList, assertList, assertList, assertProperties, assertTextEquals, assertXmlEquals, captureLoggerOutput, clearDirectory, copyDirectory, createFile, createMock, createNewClassLoader, createPlatformIndependentText, createSynchronizedMock, deleteDirectory, displayGraph, displayGraph, doMultiThreadedTest, doMultiThreadedTest, doTest, fail, findFile, findFile, findInputStream, getDisplayRunTime, getDisplayRunTime, getFileContents, getFileLocation, getItem, getPackageRelativePath, getProperty, isGuiAvailable, isPrintMessages, isSkipStressTests, isSkipTestsUsingDocker, isSkipTestsUsingGCloud, param, paramType, printHeapMemoryDiagnostics, printMessage, printMessage, printMessage, recordReturn, recordReturn, recordThrows, recordVoid, removeXmlWhiteSpacing, replayMockObjects, runBare, setDebugVerbose, setLogGC, setName, setVerbose, sleep, throwException, timeout, timeout, verifyMockObjects, waitForTrue, waitForTrue
-
Methods inherited from class junit.framework.TestCase
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setUp, toString
-
-
-
-
Field Detail
-
mapper
protected static final com.fasterxml.jackson.databind.ObjectMapper mapper
ObjectMapper
.
-
officeFloor
protected OfficeFloor officeFloor
-
-
Method Detail
-
tearDown
protected void tearDown() throws java.lang.Exception
- Overrides:
tearDown
in classjunit.framework.TestCase
- Throws:
java.lang.Exception
-
addProcedure
protected OfficeSection addProcedure(java.lang.String resourceName, java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory, java.lang.String procedureName, boolean isNext, PropertyList properties, CompileOfficeContext context)
Convenience method to add aProcedure
.- Parameters:
resourceName
- Name of resource.serviceFactory
-ProcedureSourceServiceFactory
.procedureName
- Name ofProcedure
.isNext
- Indicates if nextFlow
.properties
-PropertyList
.context
-CompileOfficeContext
.- Returns:
OfficeSection
for theProcedure
.
-
getProcedureSourceServiceFactoryClass
protected abstract java.lang.Class<? extends ProcedureSourceServiceFactory> getProcedureSourceServiceFactoryClass()
Obtains theProcedureSourceServiceFactory
Class
.- Returns:
ProcedureSourceServiceFactory
Class
.
-
getSourceName
protected java.lang.String getSourceName(java.lang.Class<? extends ProcedureSourceServiceFactory> serviceFactory)
Obtains the source name for theProcedureSourceServiceFactory
.- Parameters:
serviceFactory
-ProcedureSourceServiceFactory
Class
.- Returns:
- Source name.
-
isSupportExceptions
protected boolean isSupportExceptions()
Some languages do not provide exceptions.- Returns:
true
if supportException
.
-
testDirectPrimitives
public void testDirectPrimitives() throws java.lang.Exception
Ensure can use primitive types.- Throws:
java.lang.Exception
-
primitives
protected abstract PrimitiveTypes primitives(boolean _boolean, byte _byte, short _short, char _char, int _int, long _long, float _float, double _double) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testPrimitivesType
public void testPrimitivesType()
Ensure correctProcedureType
.
-
testInvokePrimitives
public void testInvokePrimitives() throws java.lang.Throwable
Ensure can invoke primitive types.- Throws:
java.lang.Throwable
-
primitives
protected java.lang.String primitives(CompileOfficeContext context, OfficeSectionInput handleResult)
-
primitives
protected abstract void primitives(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectObject
public void testDirectObject() throws java.lang.Exception
Ensure can pass in a Java object.- Throws:
java.lang.Exception
-
objects
protected abstract ObjectTypes objects(java.lang.String string, JavaObject object, int[] primitiveArray, JavaObject[] objectArray) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testObjectType
public void testObjectType()
Ensure correctProcedureType
.
-
testInvokeObject
public void testInvokeObject() throws java.lang.Throwable
Ensure can invoke object types.- Throws:
java.lang.Throwable
-
objects
protected java.lang.String objects(CompileOfficeContext context, OfficeSectionInput handleResult)
-
objects
protected abstract void objects(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectCollections
public void testDirectCollections() throws java.lang.Exception
Ensure can pass collections.- Throws:
java.lang.Exception
-
collections
protected abstract CollectionTypes collections(java.util.List<java.lang.Integer> list, java.util.Set<java.lang.Character> set, java.util.Map<java.lang.String,JavaObject> map) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testCollectionsType
public void testCollectionsType()
Ensure correctProcedureType
.
-
testInvokeCollections
public void testInvokeCollections() throws java.lang.Throwable
Ensure can invoke collections.- Throws:
java.lang.Throwable
-
collections
protected java.lang.String collections(CompileOfficeContext context, OfficeSectionInput handleResult)
-
collections
protected abstract void collections(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectVariables
public void testDirectVariables() throws java.lang.Exception
Ensure can handle variables.- Throws:
java.lang.Exception
-
variables
protected abstract VariableTypes variables(char val, In<java.lang.String> in, Out<JavaObject> out, Var<java.lang.Integer> var) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testVariablesType
public void testVariablesType()
Ensure correctProcedureType
.
-
testInvokeVariables
public void testInvokeVariables() throws java.lang.Throwable
Ensure can using variables.- Throws:
java.lang.Throwable
-
variables
protected void variables(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)
-
variables
protected abstract void variables(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectParameter
public void testDirectParameter() throws java.lang.Exception
Ensure can provideParameter
.- Throws:
java.lang.Exception
-
parameter
protected abstract ParameterTypes parameter(java.lang.String parameter) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testParameterType
public void testParameterType()
Ensure correctProcedureType
.
-
testInvokeParameter
public void testInvokeParameter() throws java.lang.Throwable
Ensure can use parameter.- Throws:
java.lang.Throwable
-
parameter
protected void parameter(OfficeSectionOutput pass, CompileOfficeContext context, OfficeSectionInput handleResult)
-
parameter
protected abstract void parameter(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectMultiThreaded
public void testDirectMultiThreaded() throws java.lang.Exception
Ensure safe to run directly multi-threaded.- Throws:
java.lang.Exception
-
testInvokeMultiThreaded
public void testInvokeMultiThreaded() throws java.lang.Throwable
Ensure safe to run invoked multi-threaded.- Throws:
java.lang.Throwable
-
testDirectWeb
public void testDirectWeb() throws java.lang.Exception
Ensure can run direct for web.- Throws:
java.lang.Exception
-
web
protected abstract void web(java.lang.String pathParameter, java.lang.String queryParameter, java.lang.String headerParameter, java.lang.String cookieParameter, MockHttpParameters httpParameters, MockHttpObject httpObject, ObjectResponse<WebTypes> response) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testInvokeWeb
public void testInvokeWeb() throws java.lang.Throwable
Ensure can invoke for web.- Throws:
java.lang.Throwable
-
web
protected void web(OfficeFlowSourceNode pass, CompileWebContext context)
-
web
protected abstract void web(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectHttpException
public void testDirectHttpException() throws java.lang.Throwable
Ensure can run direct forHttpException
.- Throws:
java.lang.Throwable
-
httpException
protected abstract void httpException() throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
testHttpExceptionType
public void testHttpExceptionType()
Ensure correctProcedureType
.
-
testInvokeHttpException
public void testInvokeHttpException() throws java.lang.Throwable
Ensure can invoke to handleHttpException
.- Throws:
java.lang.Throwable
-
httpException
protected void httpException(OfficeFlowSourceNode pass, CompileWebContext context)
-
httpException
protected abstract void httpException(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testFlowType
public void testFlowType()
Ensure correctProcedureType
.
-
testFlow
public void testFlow() throws java.lang.Throwable
Ensure can invoke flow.- Throws:
java.lang.Throwable
-
flow
protected java.lang.String flow(CompileOfficeContext context, OfficeSectionInput next, OfficeSectionInput flow, OfficeSectionInput flowWithCallback, OfficeSectionInput flowWithParameterAndCallback, OfficeSectionInput flowWithParameter, OfficeSectionInput exception)
-
flow
protected abstract void flow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
testDirectAsynchronousFlow
public void testDirectAsynchronousFlow() throws java.lang.Throwable
Validate directAsynchronousFlow
.- Throws:
java.lang.Throwable
-
asynchronousFlow
protected abstract void asynchronousFlow(AsynchronousFlow flowOne, AsynchronousFlow flowTwo) throws java.lang.Exception
- Throws:
java.lang.Exception
-
testAsynchronousFlowType
public void testAsynchronousFlowType()
Ensure correctProcedureType
.
-
testInvokeAsynchronousFlow
public void testInvokeAsynchronousFlow() throws java.lang.Throwable
Ensure can invokeAsynchronousFlow
.- Throws:
java.lang.Throwable
-
asynchronousFlow
protected java.lang.String asynchronousFlow(CompileOfficeContext context)
-
asynchronousFlow
protected abstract void asynchronousFlow(AbstractPolyglotProcedureTest.ProcedureBuilder builder)
-
-