AbstractProcedureImpl extends RelationalObjectImpl implements AbstractProcedure { @Override public StatementOption setStatementOption( final UnitOfWork transaction, final String optionName, final String optionValue ) throws KException { return OptionContainerUtils.setOption( transaction, this, optionName, optionValue ); } protected  AbstractProcedureImpl( final UnitOfWork uow,
                                     final Repository repository,
                                     final String workspacePath ); @Override Parameter addParameter( final UnitOfWork transaction,
                                   final String parameterName ); @Override KomodoObject[] getChildren( final UnitOfWork transaction,
                                       final String... namePatterns ); @Override KomodoType[] getChildTypes(); @Override StatementOption[] getCustomOptions( final UnitOfWork transaction ); @Override String getDescription( final UnitOfWork transaction ); @Override String getNameInSource( final UnitOfWork transaction ); @Override Parameter[] getParameters( final UnitOfWork transaction,
                                      final String... namePatterns ); @Override Model getParent( final UnitOfWork transaction ); @Override Descriptor getPrimaryType( final UnitOfWork transaction ); @Override Property getProperty( final UnitOfWork transaction,
                                 final String name ); @Override PropertyDescriptor getPropertyDescriptor( final UnitOfWork transaction,
                                                     final String propName ); @Override String[] getPropertyNames( final UnitOfWork transaction ); @Override SchemaElementType getSchemaElementType( final UnitOfWork uow ); @Override Map< String, String > getStandardOptions(); @Override String[] getStatementOptionNames( final UnitOfWork transaction ); @Override StatementOption[] getStatementOptions( final UnitOfWork transaction ); @Override int getUpdateCount( final UnitOfWork transaction ); @Override String getUuid( final UnitOfWork transaction ); @Override boolean hasProperties( final UnitOfWork transaction ); @Override boolean hasProperty( final UnitOfWork transaction,
                                final String name ); @Override boolean isCustomOption( final UnitOfWork transaction,
                                   final String name ); @Override boolean isStandardOption( final String name ); @Override void removeParameter( final UnitOfWork transaction,
                                 final String parameterName ); @Override void removeStatementOption( final UnitOfWork transaction,
                                       final String optionToRemove ); @Override void setDescription( final UnitOfWork transaction,
                                final String newDescription ); @Override void setNameInSource( final UnitOfWork transaction,
                                 final String newNameInSource ); @Override void setProperty( final UnitOfWork transaction,
                             final String propertyName,
                             final Object... values ); @Override void setSchemaElementType( final UnitOfWork uow,
                                      final SchemaElementType newSchemaElementType ); @Override StatementOption setStatementOption( final UnitOfWork transaction,
                                               final String optionName,
                                               final String optionValue ); @Override void setUpdateCount( final UnitOfWork transaction,
                                final long newUpdateCount ); @Override void setUuid( final UnitOfWork transaction,
                         final String newUuid );  }
@Test( expected = IllegalArgumentException.class ) public void shouldFailAddingEmptyStatementOptionName() throws Exception { this.procedure.setStatementOption( getTransaction(), StringConstants.EMPTY_STRING, "blah" ); }
@Test( expected = IllegalArgumentException.class ) public void shouldFailAddingNullStatementOptionName() throws Exception { this.procedure.setStatementOption( getTransaction(), null, "blah" ); }
@Test( expected = KException.class ) public void shouldFailAddingNullStatementOptionValue() throws Exception { this.procedure.setStatementOption( getTransaction(), "blah", null ); }
@Test( expected = KException.class ) public void shouldFailASettingEmptyStatementOptionValueWhenNeverAdded() throws Exception { this.procedure.setStatementOption( getTransaction(), "blah", StringConstants.EMPTY_STRING ); }
@Test public void shouldIncludeCustomOptionsWithPropertyDescriptors() throws Exception { final String customName = "blah"; this.procedure.setStatementOption( getTransaction(), customName, "elvis" ); final PropertyDescriptor[] propDescriptors = this.procedure.getPropertyDescriptors( getTransaction() ); boolean found = false; for ( final PropertyDescriptor descriptor : propDescriptors ) { if ( customName.equals( descriptor.getName() ) ) { found = true; break; } } if ( !found ) { fail( "Custom option '" + customName + "'was not included in the property descriptors" ); } }