本文整理汇总了Java中org.drools.template.parser.DecisionTableParseException类的典型用法代码示例。如果您正苦于以下问题:Java DecisionTableParseException类的具体用法?Java DecisionTableParseException怎么用?Java DecisionTableParseException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DecisionTableParseException类属于org.drools.template.parser包,在下文中一共展示了DecisionTableParseException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueBuilder
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
private ParameterizedValueBuilder getValueBuilder(final String template) {
final SnippetType type = SnippetBuilder.getType(template);
switch (type) {
case INDEXED:
return new IndexedParametersValueBuilder(template,
parameterUtilities,
ParameterizedValueBuilder.Part.RHS);
case PARAM:
return new SingleParameterValueBuilder(template,
parameterUtilities,
ParameterizedValueBuilder.Part.RHS);
case SINGLE:
return new LiteralValueBuilder(template);
}
throw new DecisionTableParseException("SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added.");
}
示例2: addTemplate
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Override
public void addTemplate(final int row,
final int column,
final String content) {
//Validate column template
if (valueBuilders.containsKey(column)) {
final String message = "Internal error: Can't have a code snippet added twice to one spreadsheet column.";
this.conversionResult.addMessage(message,
ConversionMessageType.ERROR);
return;
}
//Add new template
final String template = content.trim();
try {
this.valueBuilders.put(column,
getValueBuilder(template));
} catch (DecisionTableParseException pe) {
this.conversionResult.addMessage(pe.getMessage(),
ConversionMessageType.WARNING);
}
}
示例3: testInvalidTable
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
private void testInvalidTable( Consumer<DecisionTableXLSServiceImpl> serviceConsumer ) throws IOException {
this.service = getServiceWithValidationOverride( ( tempFile ) -> {
// mock an invalid file
Throwable t = new Throwable( "testing invalid xls dt creation" );
throw new DecisionTableParseException( "DecisionTableParseException: " + t.getMessage(), t );
} );
mockStatic( IOUtils.class );
when( IOUtils.copy( any( InputStream.class ), any( OutputStream.class ) ) ).thenReturn( 0 );
try {
serviceConsumer.accept( service );
} catch ( RuntimeException e ) {
// this is expected correct behavior
}
verify( ioService, never() ).newOutputStream( any( org.uberfire.java.nio.file.Path.class ), any( CommentedOption.class ) );
verifyStatic( never() );
}
示例4: parseFile
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
public void parseFile(File file) {
try {
parseFile(new FileInputStream(file));
}
catch (FileNotFoundException ex) {
throw new DecisionTableParseException(ex.getMessage(), ex);
}
}
示例5: addTemplate
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Override
public void addTemplate(final int row,
final int column,
final String content) {
//Validate column template
if (valueBuilders.containsKey(column)) {
final String message = "Internal error: Can't have a code snippet added twice to one spreadsheet column.";
this.conversionResult.addMessage(message,
ConversionMessageType.ERROR);
return;
}
//Add new template
String template = content.trim();
if (isBoundVar()) {
template = variable + "." + template;
}
if (!template.endsWith(";")) {
template = template + ";";
}
try {
this.valueBuilders.put(column,
getValueBuilder(template));
} catch (DecisionTableParseException pe) {
this.conversionResult.addMessage(pe.getMessage(),
ConversionMessageType.WARNING);
}
}
示例6: testValidateFileWithInvalidContent
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void testValidateFileWithInvalidContent() throws IOException {
this.service = getServiceWithValidationOverride( null );
File tempFile = File.createTempFile( "emptyxls", null );
try ( FileOutputStream tempFOS = new FileOutputStream( tempFile ) ) {
IOUtils.write( "birdplane!", tempFOS );
tempFOS.flush();
service.validate( tempFile );
}
}
示例7: getValueBuilder
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
private ParameterizedValueBuilder getValueBuilder(final String content) {
// Work out the type of "template":-
// age ---> SnippetType.SINGLE
// age == ---> SnippetType.SINGLE
// age == $param ---> SnippetType.PARAM
// age == $1 || age == $2 ---> SnippetType.INDEXED
// forall{age < $}{,} ---> SnippetType.FORALL
String template = content.trim();
SnippetType type = SnippetBuilder.getType(template);
if (type == SnippetType.SINGLE) {
type = SnippetType.PARAM;
boolean hasExplicitOperator = false;
for (String op : operators) {
if (template.endsWith(op)) {
hasExplicitOperator = true;
break;
}
}
if (!hasExplicitOperator) {
template = template + " ==";
}
template = template + " \"";
template = template + SnippetBuilder.PARAM_STRING + "\"";
}
//Make a ValueBuilder for the template
switch (type) {
case INDEXED:
return new IndexedParametersValueBuilder(template,
parameterUtilities,
ParameterizedValueBuilder.Part.LHS);
case PARAM:
return new SingleParameterValueBuilder(template,
parameterUtilities,
ParameterizedValueBuilder.Part.LHS);
case SINGLE:
return new LiteralValueBuilder(template);
}
throw new DecisionTableParseException("SnippetBuilder.SnippetType '" + type.toString() + "' is not supported. The column will not be added.");
}
示例8: testValidateNonexistentFile
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void testValidateNonexistentFile() {
this.service = getServiceWithValidationOverride( null );
service.validate( new File( "" ) );
}
示例9: testValidateEmptyFile
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void testValidateEmptyFile() throws IOException {
this.service = getServiceWithValidationOverride( null );
service.validate( File.createTempFile( "emptyxls", null ) );
}
示例10: checkConversionOfXLSWithInvalidContent
import org.drools.template.parser.DecisionTableParseException; //导入依赖的package包/类
@Test(expected = DecisionTableParseException.class)
public void checkConversionOfXLSWithInvalidContent() {
final InputStream is = this.getClass().getResourceAsStream("wrong_file.xls");
when(ioService.newInputStream(any(org.uberfire.java.nio.file.Path.class))).thenReturn(is);
converter.convert(path);
}