public JdbcSource helpCreateValidSource() {
   final JdbcSource result = factory.createJdbcSource();
   result.setName("This is a Valid Name With Trailing Spaces   "); // $NON-NLS-1$
   result.setDriverClass(CLASSES2[0]);
   // Set the URL to something valid
   result.setUrl("jdbc:oracle:thin:@slntds01:1521:ds01a"); // $NON-NLS-1$
   result.setDriverName(exactMatchDriver.getName());
   // Create the properties ...
   for (int i = 0; i < SOURCE_PROPERTY_NAMES.length; i++) {
     helpCreateProperty(result, SOURCE_PROPERTY_NAMES[i], SOURCE_PROPERTY_VALUES[i]);
   }
   helpIsValidJdbcSource(result, JdbcManagerImpl.VALID_SOURCE, IStatus.OK);
   return result;
 }
 public void testIsValidJdbcSourceWithInvalidDriverClass4() {
   sampleSource.setName("This is a Valid Name"); // $NON-NLS-1$
   sampleSource.setDriverClass("not.valid class file"); // $NON-NLS-1$
   helpIsValidJdbcSource(sampleSource, JdbcManagerImpl.ILLEGAL_CHAR_IN_CLASS_NAME, IStatus.ERROR);
 }
 public void testIsValidJdbcSourceWithInvalidDriverClass2() {
   sampleSource.setName("This is a Valid Name"); // $NON-NLS-1$
   sampleSource.setDriverClass(""); // $NON-NLS-1$
   helpIsValidJdbcSource(sampleSource, JdbcManagerImpl.MISSING_DRIVER_CLASS, IStatus.ERROR);
 }
 public void testIsValidJdbcSourceWithNameStartingWithNonLetterOrNumber() {
   sampleSource.setName("*Not Valid Name since begins with a non-letter or number"); // $NON-NLS-1$
   helpIsValidJdbcSource(
       sampleSource, JdbcManagerImpl.NAME_MUST_BEGIN_WITH_LETTER_OR_NUMBER, IStatus.ERROR);
 }
 public void testIsValidJdbcSourceWithEmptyName() {
   sampleSource.setName(""); // $NON-NLS-1$
   helpIsValidJdbcSource(sampleSource, JdbcManagerImpl.NAME_NOT_SPECIFIED, IStatus.ERROR);
 }
  /*
   * @see TestCase#setUp()
   */
  @Override
  protected void setUp() throws Exception {
    super.setUp();
    String jar_path =
        SmartTestDesignerSuite.getProjectPath("com.metamatrix.datadirect"); // $NON-NLS-1$

    JAR_FILES2 =
        new String[] {
          (new File(jar_path + "/MJbase.jar")).toURI().toURL().toString(), // $NON-NLS-1$
          (new File(jar_path + "/MJutil.jar")).toURI().toURL().toString(), // $NON-NLS-1$
          (new File(jar_path + "/MJoracle.jar")).toURI().toURL().toString() // $NON-NLS-1$
        };
    JAR_FILES_THAT_DONT_EXIST =
        new String[] {
          SmartTestDesignerSuite.getTestDataFile(getClass(), "/drivers").toURI().toURL().toString()
              + "MJbase.ZIP", //$NON-NLS-1$ //$NON-NLS-2$
          SmartTestDesignerSuite.getTestDataFile(getClass(), "/drivers").toURI().toURL().toString()
              + "MJutil.ZIP", //$NON-NLS-1$ //$NON-NLS-2$
          SmartTestDesignerSuite.getTestDataFile(getClass(), "/drivers").toURI().toURL().toString()
              + "MJoracle.ZIP" //$NON-NLS-1$ //$NON-NLS-2$
        };

    mgr = new JdbcDriverManagerForTesting();
    // mgr.start();
    sampleSource = factory.createJdbcSource();
    sampleDriver = factory.createJdbcDriver();

    // Create the source for the find method tests
    final String matchDriverName = "My Favorite Driver"; // $NON-NLS-1$
    final String matchDriverClass = CLASSES2[0];
    matchSource = factory.createJdbcSource();
    matchSource.setName("My Database"); // $NON-NLS-1$
    matchSource.setDriverName(matchDriverName);
    matchSource.setDriverClass(matchDriverClass);

    // Create a driver that the matchSource will only match by name
    nameMatchDriver = factory.createJdbcDriver();
    nameMatchDriver.setName(matchDriverName);
    nameMatchDriver.setPreferredDriverClassName(CLASSES3[0]);
    nameMatchDriver.getAvailableDriverClassNames().add(CLASSES3[0]);

    // Create a driver that the matchSource will only match by available driver
    availableClassMatchDriver = factory.createJdbcDriver();
    availableClassMatchDriver.setName(matchDriverName + " (no match)"); // $NON-NLS-1$
    availableClassMatchDriver.setPreferredDriverClassName(CLASSES2[2]);
    availableClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[0]);
    availableClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[1]);
    availableClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[2]);
    availableClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[3]);

    // Create a driver that the matchSource will only match by available driver
    preferredClassMatchDriver = factory.createJdbcDriver();
    preferredClassMatchDriver.setName(matchDriverName + " (no match)"); // $NON-NLS-1$
    preferredClassMatchDriver.setPreferredDriverClassName(matchDriverClass);
    preferredClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[0]);
    preferredClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[1]);
    preferredClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[2]);
    preferredClassMatchDriver.getAvailableDriverClassNames().add(CLASSES2[3]);

    // Create a driver that the matchSource will not match
    noMatchDriver = factory.createJdbcDriver();
    noMatchDriver.setName(matchDriverName + " (no match)"); // $NON-NLS-1$
    noMatchDriver.setPreferredDriverClassName(CLASSES3[0]);
    noMatchDriver.getAvailableDriverClassNames().add(CLASSES3[0]);

    // Create a driver that the matchSource will only match by available driver
    exactMatchDriver = factory.createJdbcDriver();
    exactMatchDriver.setName(matchDriverName);
    exactMatchDriver.setPreferredDriverClassName(matchDriverClass);
    exactMatchDriver.getAvailableDriverClassNames().add(CLASSES2[0]);
    exactMatchDriver.getAvailableDriverClassNames().add(CLASSES2[1]);
    exactMatchDriver.getAvailableDriverClassNames().add(CLASSES2[2]);
    exactMatchDriver.getAvailableDriverClassNames().add(CLASSES2[3]);
    exactMatchDriver.getJarFileUris().add(JAR_FILES2[0]);
    exactMatchDriver.getJarFileUris().add(JAR_FILES2[1]);
    exactMatchDriver.getJarFileUris().add(JAR_FILES2[2]);

    mgr.getJdbcDrivers().add(nameMatchDriver);
    mgr.getJdbcDrivers().add(availableClassMatchDriver);
    mgr.getJdbcDrivers().add(preferredClassMatchDriver);
    mgr.getJdbcDrivers().add(noMatchDriver);
    mgr.getJdbcDrivers().add(exactMatchDriver);

    metamatrixOracleDriver = factory.createJdbcDriver();
    metamatrixOracleDriver.setName("MetaMatrix JDBC for Oracle"); // $NON-NLS-1$
    metamatrixOracleDriver.getAvailableDriverClassNames().add(CLASSES2[0]);
    metamatrixOracleDriver.getAvailableDriverClassNames().add(CLASSES2[2]);
    metamatrixOracleDriver.setPreferredDriverClassName(CLASSES2[0]);
    metamatrixOracleDriver.getJarFileUris().add(JAR_FILES2[0]);
    metamatrixOracleDriver.getJarFileUris().add(JAR_FILES2[1]);
    metamatrixOracleDriver.getJarFileUris().add(JAR_FILES2[2]);

    excelDriver = factory.createJdbcDriver();
    excelDriver.setName("Microsoft Excel"); // $NON-NLS-1$
    excelDriver.getAvailableDriverClassNames().add(CLASSES3[0]);
    excelDriver.setPreferredDriverClassName(CLASSES3[0]);
    // excelDriver.getJarFileUris().add(JAR_FILES1[0]);
    mgr.getJdbcDrivers().add(excelDriver);
    excelSource = factory.createJdbcSource();
    excelSource.setName("Book1 (Excel)"); // $NON-NLS-1$
    excelSource.setDriverClass(CLASSES3[0]);
    excelSource.setDriverName("Microsoft Excel"); // $NON-NLS-1$
    excelSource.setUrl(
        "jdbc:odbc:Driver={MicroSoft Excel Driver (*.xls)};dBQ=testdata/Book1.xls"); //$NON-NLS-1$

    mgr.start();
  }