本文整理汇总了Java中org.jboss.forge.addon.ui.controller.CommandController.validate方法的典型用法代码示例。如果您正苦于以下问题:Java CommandController.validate方法的具体用法?Java CommandController.validate怎么用?Java CommandController.validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.addon.ui.controller.CommandController
的用法示例。
在下文中一共展示了CommandController.validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertValidAndExecutes
import org.jboss.forge.addon.ui.controller.CommandController; //导入方法依赖的package包/类
protected static void assertValidAndExecutes(CommandController command) throws Exception {
List<UIMessage> validate = command.validate();
for (UIMessage uiMessage : validate) {
System.out.println("Invalid value of input: " + uiMessage.getSource().getName() + " message: " + uiMessage.getDescription());
}
Result result = command.execute();
String message = result.getMessage();
assertFalse("Should not fail: " + message, result instanceof Failed);
System.out.println(message);
}
示例2: testNewJobXml
import org.jboss.forge.addon.ui.controller.CommandController; //导入方法依赖的package包/类
@Test
public void testNewJobXml() throws Exception {
Project project = factory.createTempProject(Arrays.asList(ResourcesFacet.class, JavaSourceFacet.class));
JavaClassSource reader = Roaster.parse(JavaClassSource.class, getClass().getClassLoader().getResource("templates/MyItemReader.jv"));
JavaClassSource processor = Roaster.parse(JavaClassSource.class, getClass().getClassLoader().getResource("templates/MyItemProcessor.jv"));
JavaClassSource writer = Roaster.parse(JavaClassSource.class, getClass().getClassLoader().getResource("templates/MyItemWriter.jv"));
JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
JavaResource readerResource = java.saveJavaSource(reader);
JavaResource processorResource = java.saveJavaSource(processor);
JavaResource writerResource = java.saveJavaSource(writer);
CommandController commandController = harness.createCommandController(BatchNewJobXmlCommand.class, project.getRoot());
commandController.initialize();
// set values
commandController.setValueFor("reader", readerResource.getJavaType().getQualifiedName());
commandController.setValueFor("processor", processorResource.getJavaType().getQualifiedName());
commandController.setValueFor("writer", writerResource.getJavaType().getQualifiedName());
commandController.setValueFor("jobXML", "myJob.xml");
// validate
List<UIMessage> validate = commandController.validate();
Assert.assertEquals(0, validate.size());
// execute
Result result = commandController.execute();
// verify results
Assert.assertFalse(result instanceof Failed);
}
示例3: testNewJobXmlOptionalProcessor
import org.jboss.forge.addon.ui.controller.CommandController; //导入方法依赖的package包/类
@Test
public void testNewJobXmlOptionalProcessor() throws Exception {
Project project = factory.createTempProject(Arrays.asList(ResourcesFacet.class, JavaSourceFacet.class));
JavaClassSource reader = Roaster.parse(JavaClassSource.class, getClass().getClassLoader().getResource("templates/MyItemReader.jv"));
JavaClassSource writer = Roaster.parse(JavaClassSource.class, getClass().getClassLoader().getResource("templates/MyItemWriter.jv"));
JavaSourceFacet java = project.getFacet(JavaSourceFacet.class);
JavaResource readerResource = java.saveJavaSource(reader);
JavaResource writerResource = java.saveJavaSource(writer);
CommandController commandController = harness.createCommandController(BatchNewJobXmlCommand.class, project.getRoot());
commandController.initialize();
// set values
commandController.setValueFor("reader", readerResource.getJavaType().getQualifiedName());
commandController.setValueFor("writer", writerResource.getJavaType().getQualifiedName());
commandController.setValueFor("jobXML", "myJob.xml");
// validate
List<UIMessage> validate = commandController.validate();
Assert.assertEquals(0, validate.size());
// execute
Result result = commandController.execute();
// verify results
Assert.assertFalse(result instanceof Failed);
}