当前位置: 首页>>代码示例>>Java>>正文


Java CommandController.validate方法代码示例

本文整理汇总了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);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:12,代码来源:NewNodeXmlTest.java

示例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);
}
 
开发者ID:javaee-samples,项目名称:forge-addons,代码行数:31,代码来源:BatchNewJobXmlCommandTest.java

示例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);
}
 
开发者ID:javaee-samples,项目名称:forge-addons,代码行数:29,代码来源:BatchNewJobXmlCommandTest.java


注:本文中的org.jboss.forge.addon.ui.controller.CommandController.validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。