Package org.jboss.dna.common.jdbc.model.api

Examples of org.jboss.dna.common.jdbc.model.api.DatabaseMetaDataMethodException


    public void testAddException() {
        String MESSAGE = "Database MetaData Method Exception";
        String METHOD_NAME = "myMethod";

        // create DatabaseMetaDataMethodException
        DatabaseMetaDataMethodException exception = new DatabaseMetaDataMethodException(MESSAGE, METHOD_NAME, null);
        // add Exception to error list
        bean.addException(exception);

        // get list of exceptions
        List<DatabaseMetaDataMethodException> exceptionList = bean.getExceptionList();
View Full Code Here


    public void testFindException() {
        String MESSAGE = "Database MetaData Method Exception";
        String METHOD_NAME = "myMethod";

        // create DatabaseMetaDataMethodException
        DatabaseMetaDataMethodException exception = new DatabaseMetaDataMethodException(MESSAGE, METHOD_NAME, null);
        // add Exception to error list
        bean.addException(exception);

        // check that the exception found
        assertSame("Unable to find database metadata method exception", exception, bean.findException(METHOD_NAME));
View Full Code Here

    public void testDatabaseMetaDataMethodFailed() {
        String MESSAGE = "Database MetaData Method Exception";
        String METHOD_NAME = "myMethod";

        // create DatabaseMetaDataMethodException
        DatabaseMetaDataMethodException exception = new DatabaseMetaDataMethodException(MESSAGE, METHOD_NAME, null);
        // add Exception to error list
        bean.addException(exception);

        // check that the exception found
        assertTrue("The database metadata method " + METHOD_NAME + " should be failed",
View Full Code Here

                                             procedureSchema,
                                             procedureCatalog));
            }
            // if fail is enabled
            if (failOnError && (catalog == null)) {
                throw new DatabaseMetaDataMethodException("Catalog name shall be provided", "populateStoredProcedure");
            }
        }

        // set schema
        if ((procedureSchema != null) && (procedureSchema.trim().length() != 0)) {
            // find schema
            Schema schema = database.findSchemaByName(procedureCatalog, procedureSchema);
            // set schema
            sp.setSchema(schema);
            // warn if null
            if (schema == null) {
                traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the procedure %s (schema %s, catalog %s)",
                                             database.getName(),
                                             procedureName,
                                             procedureSchema,
                                             procedureCatalog));
            }
            // if fail is enabled
            if (failOnError && (schema == null)) {
                throw new DatabaseMetaDataMethodException("Schema name shall be provided", "populateStoredProcedure");
            }
        }

        // ***********************
        // *** StoredProcedure ***
 
View Full Code Here

                                             tableSchema,
                                             tableCatalog));
            }
            // if fail is enabled
            if (failOnError) {
                throw new DatabaseMetaDataMethodException("Catalog name shall be provided", "populateTable");

            }
        }

        // set schema
        if ((tableSchema != null) && (tableSchema.trim().length() != 0)) {
            // find schema
            Schema schema = database.findSchemaByName(tableCatalog, tableSchema);
            // set schema
            table.setSchema(schema);
            // warn if null
            if (schema == null) {
                traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the table %s (schema %s, catalog %s)",
                                             database.getName(),
                                             tableName,
                                             tableSchema,
                                             tableCatalog));
            }
            // if fail is enabled
            if (failOnError) {
                throw new DatabaseMetaDataMethodException("Table name shall be provided", "populateTable");
            }
        }

        // **************
        // *** Table ***
        // **************

        // set table type
        if (tableTypeName != null) {
            // create
            TableType tableType = factory.createTableType();
            // fill
            tableType.setName(tableTypeName);
            // set type
            table.setTableType(tableType);
        }

        // set catalog
        if ((typeCatalogName != null) && (typeCatalogName.trim().length() != 0)) {
            // find catalog
            Catalog typeCatalog = database.findCatalogByName(typeCatalogName);
            // set type catalog
            table.setTypeCatalog(typeCatalog);
            // warn if null
            if (typeCatalog == null) {
                traceLog.debug(String.format("[Database %s] Unable to find catalog '%4$s' for the table %s (schema %s, catalog %s)",
                                             database.getName(),
                                             tableName,
                                             tableSchema,
                                             typeCatalogName));
            }
        }

        // set schema
        if ((typeSchemaName != null) && (typeSchemaName.trim().length() != 0)) {
            // find schema
            Schema typeSchema = database.findSchemaByName(typeCatalogName, typeSchemaName);
            // set schema
            table.setTypeSchema(typeSchema);
            // warn if null
            if (typeSchema == null) {
                traceLog.debug(String.format("[Database %s] Unable to find schema '%3$s' for the table %s (schema %s, catalog %s)",
                                             database.getName(),
                                             tableName,
                                             typeSchemaName,
                                             typeCatalogName));
            }
            // if fail is enabled
            if (failOnError && (typeSchema == null)) {
                throw new DatabaseMetaDataMethodException("Schema name shall be provided", "populateTable");
            }
        }

        // set type name
        table.setTypeName(typeName);
View Full Code Here

                                           columnName);
                traceLog.debug(errMessage);
            }
            // if fail is enabled
            if (failOnError && (tableColumn == null)) {
                throw new DatabaseMetaDataMethodException(errMessage, "populatePrimaryKey");
            }

            // create PK column
            PrimaryKeyColumn pkColumn = factory.createPrimaryKeyColumn();
            // check if we found the original table column
View Full Code Here

                                               fkColumnName);
                    traceLog.debug(errMessage);
                }
                // if fail is enabled
                if (failOnError && (tableColumn == null)) {
                    throw new DatabaseMetaDataMethodException(errMessage, "populateForeignKeys");
                }

                // create FK column
                ForeignKeyColumn fkColumn = factory.createForeignKeyColumn();
View Full Code Here

                                               indexColumnName);
                    traceLog.debug(errMessage);
                }
                // if fail is enabled
                if (failOnError && (tableColumn == null)) {
                    throw new DatabaseMetaDataMethodException(errMessage, "populateIndexes");

                }

                // create index column
                IndexColumn indexColumn = factory.createIndexColumn();
View Full Code Here

                                           udtCatalog);
                traceLog.debug(errMessage);
            }
            // if fail is enabled
            if (failOnError) {
                throw new DatabaseMetaDataMethodException(errMessage, "populateUDT");
            }
        }

        // set schema
        if ((udtSchema != null) && (udtSchema.trim().length() != 0)) {
            // find schema
            Schema schema = database.findSchemaByName(udtCatalog, udtSchema);
            // set schema
            udt.setSchema(schema);

            String errMessage = null;
            // warn if null
            if (schema == null) {
                errMessage = String.format("[Database %s] Unable to find schema '%3$s' for the UDT %s (schema %s, catalog %s)",
                                           database.getName(),
                                           udtName,
                                           udtSchema,
                                           udtCatalog);
                traceLog.debug(errMessage);
            }
            // if fail is enabled
            if (failOnError) {
                throw new DatabaseMetaDataMethodException(errMessage, "populateUTD");

            }
        }

        // **************
 
View Full Code Here

TOP

Related Classes of org.jboss.dna.common.jdbc.model.api.DatabaseMetaDataMethodException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.