@Test public void testCreateValueMeta() throws KettlePluginException { ValueMetaInterface testObject; try { testObject = ValueMetaFactory.createValueMeta( Integer.MIN_VALUE ); fail(); } catch ( KettlePluginException expected ) { } try { testObject = ValueMetaFactory.createValueMeta( null, Integer.MIN_VALUE ); fail(); } catch ( KettlePluginException expected ) { } try { testObject = ValueMetaFactory.createValueMeta( null, Integer.MIN_VALUE, 10, 10 ); fail(); } catch ( KettlePluginException expected ) { } testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_NONE ); assertTrue( testObject instanceof ValueMetaNone ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testNone", ValueMetaInterface.TYPE_NONE ); assertTrue( testObject instanceof ValueMetaNone ); assertEquals( "testNone", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testNone", ValueMetaInterface.TYPE_NONE, 10, 20 ); assertTrue( testObject instanceof ValueMetaNone ); assertEquals( "testNone", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_NUMBER ); assertTrue( testObject instanceof ValueMetaNumber ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testNumber", ValueMetaInterface.TYPE_NUMBER ); assertTrue( testObject instanceof ValueMetaNumber ); assertEquals( "testNumber", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testNumber", ValueMetaInterface.TYPE_NUMBER, 10, 20 ); assertTrue( testObject instanceof ValueMetaNumber ); assertEquals( "testNumber", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_STRING ); assertTrue( testObject instanceof ValueMetaString ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testString", ValueMetaInterface.TYPE_STRING ); assertTrue( testObject instanceof ValueMetaString ); assertEquals( "testString", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testString", ValueMetaInterface.TYPE_STRING, 1000, 50 ); assertTrue( testObject instanceof ValueMetaString ); assertEquals( "testString", testObject.getName() ); assertEquals( 1000, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_DATE ); assertTrue( testObject instanceof ValueMetaDate ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testDate", ValueMetaInterface.TYPE_DATE ); assertTrue( testObject instanceof ValueMetaDate ); assertEquals( "testDate", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testDate", ValueMetaInterface.TYPE_DATE, 10, 20 ); assertTrue( testObject instanceof ValueMetaDate ); assertEquals( "testDate", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_BOOLEAN ); assertTrue( testObject instanceof ValueMetaBoolean ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testBoolean", ValueMetaInterface.TYPE_BOOLEAN ); assertTrue( testObject instanceof ValueMetaBoolean ); assertEquals( "testBoolean", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testBoolean", ValueMetaInterface.TYPE_BOOLEAN, 10, 20 ); assertTrue( testObject instanceof ValueMetaBoolean ); assertEquals( "testBoolean", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_INTEGER ); assertTrue( testObject instanceof ValueMetaInteger ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( 0, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testInteger", ValueMetaInterface.TYPE_INTEGER ); assertTrue( testObject instanceof ValueMetaInteger ); assertEquals( "testInteger", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( 0, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testInteger", ValueMetaInterface.TYPE_INTEGER, 10, 20 ); assertTrue( testObject instanceof ValueMetaInteger ); assertEquals( "testInteger", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 0, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_BIGNUMBER ); assertTrue( testObject instanceof ValueMetaBigNumber ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testBigNumber", ValueMetaInterface.TYPE_BIGNUMBER ); assertTrue( testObject instanceof ValueMetaBigNumber ); assertEquals( "testBigNumber", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testBigNumber", ValueMetaInterface.TYPE_BIGNUMBER, 10, 20 ); assertTrue( testObject instanceof ValueMetaBigNumber ); assertEquals( "testBigNumber", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_SERIALIZABLE ); assertTrue( testObject instanceof ValueMetaSerializable ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testSerializable", ValueMetaInterface.TYPE_SERIALIZABLE ); assertTrue( testObject instanceof ValueMetaSerializable ); assertEquals( "testSerializable", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testSerializable", ValueMetaInterface.TYPE_SERIALIZABLE, 10, 20 ); assertTrue( testObject instanceof ValueMetaSerializable ); assertEquals( "testSerializable", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_BINARY ); assertTrue( testObject instanceof ValueMetaBinary ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( 0, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testBinary", ValueMetaInterface.TYPE_BINARY ); assertTrue( testObject instanceof ValueMetaBinary ); assertEquals( "testBinary", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( 0, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testBinary", ValueMetaInterface.TYPE_BINARY, 10, 20 ); assertTrue( testObject instanceof ValueMetaBinary ); assertEquals( "testBinary", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 0, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_TIMESTAMP ); assertTrue( testObject instanceof ValueMetaTimestamp ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testTimestamp", ValueMetaInterface.TYPE_TIMESTAMP ); assertTrue( testObject instanceof ValueMetaTimestamp ); assertEquals( "testTimestamp", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testTimestamp", ValueMetaInterface.TYPE_TIMESTAMP, 10, 20 ); assertTrue( testObject instanceof ValueMetaTimestamp ); assertEquals( "testTimestamp", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( ValueMetaInterface.TYPE_INET ); assertTrue( testObject instanceof ValueMetaInternetAddress ); assertEquals( null, testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testInternetAddress", ValueMetaInterface.TYPE_INET ); assertTrue( testObject instanceof ValueMetaInternetAddress ); assertEquals( "testInternetAddress", testObject.getName() ); assertEquals( -1, testObject.getLength() ); assertEquals( -1, testObject.getPrecision() ); testObject = ValueMetaFactory.createValueMeta( "testInternetAddress", ValueMetaInterface.TYPE_INET, 10, 20 ); assertTrue( testObject instanceof ValueMetaInternetAddress ); assertEquals( "testInternetAddress", testObject.getName() ); assertEquals( 10, testObject.getLength() ); assertEquals( 20, testObject.getPrecision() ); }
public static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ) throws KettlePluginException { PluginInterface stringPlugin = pluginRegistry.getPlugin( ValueMetaPluginType.class, String.valueOf( type ) ); if ( stringPlugin == null ) { throw new KettlePluginException( "Unable to locate value meta plugin of type (id) " + type ); } ValueMetaInterface valueMeta = pluginRegistry.loadClass( stringPlugin, ValueMetaInterface.class ); valueMeta.setName( name ); valueMeta.setLength( length, precision ); return valueMeta; }
ValueMetaFactory { public static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ) throws KettlePluginException { PluginInterface stringPlugin = pluginRegistry.getPlugin( ValueMetaPluginType.class, String.valueOf( type ) ); if ( stringPlugin == null ) { throw new KettlePluginException( "Unable to locate value meta plugin of type (id) " + type ); } ValueMetaInterface valueMeta = pluginRegistry.loadClass( stringPlugin, ValueMetaInterface.class ); valueMeta.setName( name ); valueMeta.setLength( length, precision ); return valueMeta; } }
ValueMetaFactory { public static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ) throws KettlePluginException { PluginInterface stringPlugin = pluginRegistry.getPlugin( ValueMetaPluginType.class, String.valueOf( type ) ); if ( stringPlugin == null ) { throw new KettlePluginException( "Unable to locate value meta plugin of type (id) " + type ); } ValueMetaInterface valueMeta = pluginRegistry.loadClass( stringPlugin, ValueMetaInterface.class ); valueMeta.setName( name ); valueMeta.setLength( length, precision ); return valueMeta; }  }
ValueMetaFactory { public static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ) throws KettlePluginException { PluginInterface stringPlugin = pluginRegistry.getPlugin( ValueMetaPluginType.class, String.valueOf( type ) ); if ( stringPlugin == null ) { throw new KettlePluginException( "Unable to locate value meta plugin of type (id) " + type ); } ValueMetaInterface valueMeta = pluginRegistry.loadClass( stringPlugin, ValueMetaInterface.class ); valueMeta.setName( name ); valueMeta.setLength( length, precision ); return valueMeta; }  static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ); static ValueMetaInterface createValueMeta( String name, int type ); static ValueMetaInterface createValueMeta( int type ); static ValueMetaInterface cloneValueMeta( ValueMetaInterface source ); static ValueMetaInterface cloneValueMeta( ValueMetaInterface source, int targetType ); static String[] getValueMetaNames(); static String[] getAllValueMetaNames(); static String getValueMetaName( int type ); static int getIdForValueMeta( String valueMetaName ); static List<ValueMetaInterface> getValueMetaPluginClasses(); static ValueMetaInterface guessValueMetaInterface( Object object ); }
ValueMetaFactory { public static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ) throws KettlePluginException { PluginInterface stringPlugin = pluginRegistry.getPlugin( ValueMetaPluginType.class, String.valueOf( type ) ); if ( stringPlugin == null ) { throw new KettlePluginException( "Unable to locate value meta plugin of type (id) " + type ); } ValueMetaInterface valueMeta = pluginRegistry.loadClass( stringPlugin, ValueMetaInterface.class ); valueMeta.setName( name ); valueMeta.setLength( length, precision ); return valueMeta; }  static ValueMetaInterface createValueMeta( String name, int type, int length, int precision ); static ValueMetaInterface createValueMeta( String name, int type ); static ValueMetaInterface createValueMeta( int type ); static ValueMetaInterface cloneValueMeta( ValueMetaInterface source ); static ValueMetaInterface cloneValueMeta( ValueMetaInterface source, int targetType ); static String[] getValueMetaNames(); static String[] getAllValueMetaNames(); static String getValueMetaName( int type ); static int getIdForValueMeta( String valueMetaName ); static List<ValueMetaInterface> getValueMetaPluginClasses(); static ValueMetaInterface guessValueMetaInterface( Object object ); static PluginRegistry pluginRegistry; }