use of org.apache.tapestry5.runtime.RenderQueue in project tapestry-5 by apache.
the class CompositeRenderCommandTest method render_queue_commands_nyi.
@Test(dataProvider = "nyi_data")
public void render_queue_commands_nyi(RenderCommand rc) {
MarkupWriter writer = mockMarkupWriter();
RenderQueue queue = mockRenderQueue();
try {
new CompositeRenderCommand(new RenderCommand[] { rc }).render(writer, queue);
unreachable();
} catch (IllegalStateException ex) {
// Don't care about the message.
}
}
use of org.apache.tapestry5.runtime.RenderQueue in project tapestry-5 by apache.
the class RenderQueueImplTest method run_commands.
@Test
public void run_commands() {
final RenderCommand command2 = newMock(RenderCommand.class);
RenderCommand command1 = new RenderCommand() {
public void render(MarkupWriter writer, RenderQueue queue) {
queue.push(command2);
}
};
Logger logger = mockLogger();
MarkupWriter writer = mockMarkupWriter();
RenderQueueImpl queue = new RenderQueueImpl(logger);
// There's only one check for trace enabled now.
expect(logger.isTraceEnabled(TapestryMarkers.RENDER_COMMANDS)).andReturn(false);
expect(logger.isDebugEnabled()).andReturn(true);
logger.debug(eq(TapestryMarkers.RENDER_COMMANDS), isA(String.class));
command2.render(writer, queue);
replay();
queue.push(command1);
queue.run(writer);
verify();
}
use of org.apache.tapestry5.runtime.RenderQueue in project tapestry-5 by apache.
the class RenderQueueImplTest method command_failed.
@Test
public void command_failed() {
ComponentResources foo = mockInternalComponentResources();
ComponentResources bar = mockInternalComponentResources();
ComponentResources baz = mockInternalComponentResources();
final RuntimeException t = new RuntimeException("Oops.");
RenderCommand rc = new RenderCommand() {
public void render(MarkupWriter writer, RenderQueue queue) {
throw t;
}
@Override
public String toString() {
return "FailedCommand";
}
};
Logger logger = mockLogger();
MarkupWriter writer = mockMarkupWriter();
expect(logger.isTraceEnabled(TapestryMarkers.RENDER_COMMANDS)).andReturn(false);
expect(logger.isDebugEnabled()).andReturn(true);
logger.error("Render queue error in FailedCommand: Oops.", t);
replay();
RenderQueueImpl queue = new RenderQueueImpl(logger);
queue.startComponent(foo);
queue.startComponent(bar);
queue.endComponent();
queue.startComponent(baz);
queue.push(rc);
try {
queue.run(writer);
unreachable();
} catch (RenderQueueException ex) {
assertSame(ex.getCause(), t);
assertArraysEqual(ex.getActiveComponents(), new Object[] { foo, baz });
}
verify();
}
use of org.apache.tapestry5.runtime.RenderQueue in project tapestry-5 by apache.
the class BlockImplTest method body_pushed_to_queue_backwards.
@Test
public void body_pushed_to_queue_backwards() {
BlockImpl block = new BlockImpl(null, null);
RenderQueue queue = mockRenderQueue();
MarkupWriter writer = mockMarkupWriter();
RenderCommand element1 = mockRenderCommand();
RenderCommand element2 = mockRenderCommand();
getMocksControl().checkOrder(true);
queue.push(element2);
queue.push(element1);
replay();
block.addToBody(element1);
block.addToBody(element2);
block.render(writer, queue);
verify();
}
use of org.apache.tapestry5.runtime.RenderQueue in project tapestry-5 by apache.
the class ExpansionPageElementImplTest method invariant_binding_is_cached.
@Test
public void invariant_binding_is_cached() {
Binding binding = mockBinding();
TypeCoercer coercer = mockTypeCoercer();
MarkupWriter writer = mockMarkupWriter();
RenderQueue queue = mockRenderQueue();
Object value = new Object();
train_isInvariant(binding, true);
replay();
RenderCommand element = new ExpansionPageElement(binding, coercer);
verify();
train_get(binding, value);
train_coerce(coercer, value, String.class, "STRING-VALUE");
writer.write("STRING-VALUE");
replay();
element.render(writer, queue);
verify();
// It is now cached ...
writer.write("STRING-VALUE");
replay();
element.render(writer, queue);
verify();
}
Aggregations