@Test public void testIsBulkInstruction() { Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "deploy and start all /vm" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "Stop all /vm" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "undeploy all /vm" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "delete /vm" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "deploy and start all instances of toto" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "Stop all instances of toto" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "undeploy all instances of toto" )); Assert.assertTrue( BulkCommandInstructions.isBulkInstruction( "delete all instances of toto" )); Assert.assertFalse( BulkCommandInstructions.isBulkInstruction( "deploy /vm" )); Assert.assertFalse( BulkCommandInstructions.isBulkInstruction( "" )); Assert.assertFalse( BulkCommandInstructions.isBulkInstruction( "deploy all instances of toto" )); Assert.assertFalse( BulkCommandInstructions.isBulkInstruction( "deploy and start all toto" )); }
public static boolean isBulkInstruction( String line ) { boolean match = false; Pattern[] patterns = { getPatternForInstancePath(), getPatternForComponentName() }; for( Pattern p : patterns ) { Matcher m = p.matcher( line ); if( m.matches() && ChangeStateInstruction.which( m.group( 1 ).trim()) != null ) { match = true; break; } } return match; }
BulkCommandInstructions extends AbstractCommandInstruction { public static boolean isBulkInstruction( String line ) { boolean match = false; Pattern[] patterns = { getPatternForInstancePath(), getPatternForComponentName() }; for( Pattern p : patterns ) { Matcher m = p.matcher( line ); if( m.matches() && ChangeStateInstruction.which( m.group( 1 ).trim()) != null ) { match = true; break; } } return match; } }
BulkCommandInstructions extends AbstractCommandInstruction { public static boolean isBulkInstruction( String line ) { boolean match = false; Pattern[] patterns = { getPatternForInstancePath(), getPatternForComponentName() }; for( Pattern p : patterns ) { Matcher m = p.matcher( line ); if( m.matches() && ChangeStateInstruction.which( m.group( 1 ).trim()) != null ) { match = true; break; } } return match; } BulkCommandInstructions( Context context, String instruction, int line ); }
BulkCommandInstructions extends AbstractCommandInstruction { public static boolean isBulkInstruction( String line ) { boolean match = false; Pattern[] patterns = { getPatternForInstancePath(), getPatternForComponentName() }; for( Pattern p : patterns ) { Matcher m = p.matcher( line ); if( m.matches() && ChangeStateInstruction.which( m.group( 1 ).trim()) != null ) { match = true; break; } } return match; } BulkCommandInstructions( Context context, String instruction, int line ); static boolean isBulkInstruction( String line ); @Override List<ParsingError> doValidate(); @Override void updateContext(); String getInstancePath(); String getComponentName(); ChangeStateInstruction getChangeStateInstruction(); }
BulkCommandInstructions extends AbstractCommandInstruction { public static boolean isBulkInstruction( String line ) { boolean match = false; Pattern[] patterns = { getPatternForInstancePath(), getPatternForComponentName() }; for( Pattern p : patterns ) { Matcher m = p.matcher( line ); if( m.matches() && ChangeStateInstruction.which( m.group( 1 ).trim()) != null ) { match = true; break; } } return match; } BulkCommandInstructions( Context context, String instruction, int line ); static boolean isBulkInstruction( String line ); @Override List<ParsingError> doValidate(); @Override void updateContext(); String getInstancePath(); String getComponentName(); ChangeStateInstruction getChangeStateInstruction();  }