Esempio n. 1
0
  @Test
  public void testServerAuthIndirect_Client() throws Exception {
    Map<String, Object> props = new HashMap<String, Object>();

    // No properties are set, an appropriate EntitySaslClient should be returned
    SaslClient client =
        Sasl.createSaslClient(
            new String[] {SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC},
            "TestUser",
            "TestProtocol",
            "TestServer",
            props,
            null);
    assertEquals(EntitySaslClient.class, client.getClass());
    assertEquals(
        SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC, client.getMechanismName());

    // If we set SERVER_AUTH to true even though only unilateral mechanisms are specified, no client
    // should be returned
    props.put(Sasl.SERVER_AUTH, Boolean.toString(true));
    client =
        Sasl.createSaslClient(
            new String[] {
              SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
              SaslMechanismInformation.Names.IEC_ISO_9798_U_DSA_SHA1,
              SaslMechanismInformation.Names.IEC_ISO_9798_U_ECDSA_SHA1
            },
            "TestUser",
            "TestProtocol",
            "TestServer",
            props,
            null);
    assertNull(client);

    // If we set SERVER_AUTH to true, an appropriate EntitySaslClient should be returned
    props.put(Sasl.SERVER_AUTH, Boolean.toString(true));
    client =
        Sasl.createSaslClient(
            new String[] {
              SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
              SaslMechanismInformation.Names.IEC_ISO_9798_U_DSA_SHA1,
              SaslMechanismInformation.Names.IEC_ISO_9798_U_ECDSA_SHA1,
              SaslMechanismInformation.Names.IEC_ISO_9798_M_RSA_SHA1_ENC,
              SaslMechanismInformation.Names.IEC_ISO_9798_M_DSA_SHA1,
              SaslMechanismInformation.Names.IEC_ISO_9798_M_ECDSA_SHA1
            },
            "TestUser",
            "TestProtocol",
            "TestServer",
            props,
            null);
    assertEquals(EntitySaslClient.class, client.getClass());
    assertEquals(
        SaslMechanismInformation.Names.IEC_ISO_9798_M_RSA_SHA1_ENC, client.getMechanismName());
  }
 @Test
 public void testAuthenticateFail() {
   System.out.println("authenticate Pass");
   Login login = new Login("notadmin", "notrosebud");
   AuthenticationMgr authMgr = new AuthenticationMgr();
   boolean expResult = false;
   try {
     Boolean value = authMgr.authenticate(login);
     boolean result = value.booleanValue();
     assertEquals(expResult, result);
   } catch (Exception e) {
     fail("Exception Thrown");
   }
 }
  @Before
  public void setUp() throws Exception {
    try {
      FileReader reader = new FileReader("inventory.txt");
      BufferedReader br = new BufferedReader(reader);

      String row = br.readLine();
      while (row != null) {
        String articleinfo[] = row.split(":");

        char barcode[] = articleinfo[0].toCharArray();
        String name = articleinfo[1];
        int amount = Integer.parseInt(articleinfo[2]);
        double price = Double.parseDouble(articleinfo[3]);
        boolean food = Boolean.parseBoolean(articleinfo[4]);

        tempInventory.add(new cashRegisterSystem.inventoryArticle(barcode, name, amount, price));
        row = br.readLine();
      }

      br.close();
    } catch (IOException e) {
      System.out.println("Error" + e.getMessage());
      System.out.println("Error reading File");
    }

    CRS.newItem(Long.parseLong(sBarcode), sArticleName, dPrice, iAmountInventory, isFood);
    CRS.writeInventory();
  }
Esempio n. 4
0
 private Xid randomXid(Boolean trueForPositive) {
   while (true) {
     Xid xid = new XidImpl(randomBytes(), randomBytes());
     if (trueForPositive == null || xid.hashCode() > 0 == trueForPositive.booleanValue())
       return xid;
   }
 }
Esempio n. 5
0
 private Properties getAuthenticationHandlerConfiguration(boolean anonymousAllowed) {
   Properties props = new Properties();
   props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
   props.setProperty(
       PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, Boolean.toString(anonymousAllowed));
   return props;
 }
  private void createStandardBag(boolean allowLazyAdding) {
    try {
      m_bag = null;

      final Object initArgs[] = {
        new NamedValue("AutomaticAddition", Boolean.valueOf(allowLazyAdding))
      };

      final String serviceName = "com.sun.star.beans.PropertyBag";
      m_bag =
          UnoRuntime.queryInterface(
              XPropertyContainer.class, m_orb.createInstanceWithArguments(serviceName, initArgs));
      if (m_bag == null) {
        fail("could not create a " + serviceName + " instance");
      }
      m_set = UnoRuntime.queryInterface(XPropertySet.class, m_bag);
      m_access = UnoRuntime.queryInterface(XPropertyAccess.class, m_bag);

      final Object properties[][] = {
        {"BoolValue", Boolean.TRUE},
        {"StringValue", ""},
        {"IntegerValue", Integer.valueOf(3)},
        {"InterfaceValue", m_bag}
      };
      for (int i = 0; i < properties.length; ++i) {
        m_bag.addProperty((String) properties[i][0], PropertyAttribute.MAYBEVOID, properties[i][1]);
      }
    } catch (com.sun.star.uno.Exception e) {
    }
  }
Esempio n. 7
0
  @Test
  public void testServerAuthDirect_Client() {
    SaslClientFactory factory = obtainSaslClientFactory(EntitySaslClientFactory.class);
    assertNotNull("SaslClientFactory not registered", factory);

    String[] mechanisms;
    Map<String, Object> props = new HashMap<String, Object>();

    // No properties set
    mechanisms = factory.getMechanismNames(props);
    assertMechanisms(
        new String[] {
          SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
              SaslMechanismInformation.Names.IEC_ISO_9798_M_RSA_SHA1_ENC,
              SaslMechanismInformation.Names.IEC_ISO_9798_U_DSA_SHA1,
          SaslMechanismInformation.Names.IEC_ISO_9798_M_DSA_SHA1,
              SaslMechanismInformation.Names.IEC_ISO_9798_U_ECDSA_SHA1,
              SaslMechanismInformation.Names.IEC_ISO_9798_M_ECDSA_SHA1
        },
        mechanisms);

    // Request server auth
    props.put(Sasl.SERVER_AUTH, Boolean.toString(true));
    mechanisms = factory.getMechanismNames(props);
    assertMechanisms(
        new String[] {
          SaslMechanismInformation.Names.IEC_ISO_9798_M_RSA_SHA1_ENC,
          SaslMechanismInformation.Names.IEC_ISO_9798_M_DSA_SHA1,
          SaslMechanismInformation.Names.IEC_ISO_9798_M_ECDSA_SHA1
        },
        mechanisms);
  }
Esempio n. 8
0
  @Test
  public void testServerAuthIndirect_Server() throws Exception {
    Map<String, Object> props = new HashMap<String, Object>();

    // No properties are set, an appropriate EntitySaslServer should be returned
    SaslServer server =
        Sasl.createSaslServer(
            SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
            "TestProtocol",
            "TestServer",
            props,
            null);
    assertEquals(EntitySaslServer.class, server.getClass());
    assertEquals(
        SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC, server.getMechanismName());

    // If we set SERVER_AUTH to true even though a unilateral mechanism is specified, no server
    // should be returned
    props.put(Sasl.SERVER_AUTH, Boolean.toString(true));
    server =
        Sasl.createSaslServer(
            SaslMechanismInformation.Names.IEC_ISO_9798_U_RSA_SHA1_ENC,
            "TestProtocol",
            "TestServer",
            props,
            null);
    assertNull(server);
  }
Esempio n. 9
0
  @Test
  public void shouldNotifyUserWhenEmailAddressesAreDifferent() {
    driver.get(URL);
    String title = driver.getTitle();
    assertEquals("Rule Financial Registration Form", title);

    int randomIntNUmberForRegistration = this.generator.nextInt(100000);

    driver.findElement(By.name("firstName")).clear();
    driver.findElement(By.name("firstName")).sendKeys("Marcin");
    driver.findElement(By.name("lastName")).clear();
    driver.findElement(By.name("lastName")).sendKeys("Kowalczyk");

    String email = new String("marcinkowalczyk" + randomIntNUmberForRegistration + "@gmail.com");

    driver.findElement(By.name("email")).clear();
    driver.findElement(By.name("email")).sendKeys(email);
    driver.findElement(By.name("repeatEmail")).clear();
    driver.findElement(By.name("repeatEmail")).sendKeys("wrong" + email);

    WebElement divErrorEmailAdress =
        driver.findElement(By.xpath("html/body/div[2]/div[2]/div/div/div/div[5]/div/div"));
    boolean ariaHidden = Boolean.getBoolean(divErrorEmailAdress.getAttribute("aria-hidden"));
    assertEquals(ariaHidden, false);
  }
  @Test
  public void testOverlaps() throws NoSuchIdentifierException, ProcessException {

    GeometryFactory fact = new GeometryFactory();

    // Inputs first
    final LinearRing ring =
        fact.createLinearRing(
            new Coordinate[] {
              new Coordinate(0.0, 0.0),
              new Coordinate(0.0, 10.0),
              new Coordinate(5.0, 10.0),
              new Coordinate(5.0, 0.0),
              new Coordinate(0.0, 0.0)
            });

    final Geometry geom1 = fact.createPolygon(ring, null);

    final LinearRing ring2 =
        fact.createLinearRing(
            new Coordinate[] {
              new Coordinate(-5.0, 0.0),
              new Coordinate(-5.0, 10.0),
              new Coordinate(2.0, 10.0),
              new Coordinate(2.0, 0.0),
              new Coordinate(-5.0, 0.0)
            });

    final Geometry geom2 = fact.createPolygon(ring2, null);
    // Process
    final ProcessDescriptor desc = ProcessFinder.getProcessDescriptor("jts", "overlaps");

    final ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("geom1").setValue(geom1);
    in.parameter("geom2").setValue(geom2);
    final org.geotoolkit.process.Process proc = desc.createProcess(in);

    // result
    final Boolean result = (Boolean) proc.call().parameter("result").getValue();

    final Boolean expected = geom1.overlaps(geom2);

    assertTrue(expected.equals(result));
  }
 @Before
 public void setUp() {
   if (!Boolean.parseBoolean(System.getProperty("test.solr.verbose"))) {
     java.util.logging.Logger.getLogger("org.apache.solr")
         .setLevel(java.util.logging.Level.SEVERE);
     Utils.setLog4jLogLevel(org.apache.log4j.Level.WARN);
   }
   testDataParentPath = System.getProperty("test.data.path");
   testConfigFname = System.getProperty("test.config.file");
   // System.out.println("-----testDataParentPath = "+testDataParentPath);
 }
  protected TicketBookingRequest fillMeARequest() {
    TicketBookingRequest request = new TicketBookingRequest();

    request.setRulesAndRegulationsAcceptance(Boolean.valueOf(true));

    request.setSubscriberLastName("SubscriberLastName");

    request.setSubscriberNumber("SubscriberNumber");

    request.setSubscriberFirstName("SubscriberFirstName");

    request.setIsSubscriber(Boolean.valueOf(true));

    request.setPaymentReference("PaymentReference");

    // Means Of Contact
    MeansOfContact meansOfContact =
        meansOfContactService.getMeansOfContactByType(MeansOfContactEnum.EMAIL);
    request.setMeansOfContact(meansOfContact);
    TicketBookingRequestFeeder.feed(request);
    return request;
  }
Esempio n. 13
0
 private EnvironmentConfig makeBasicConfig() {
   EnvironmentConfig ec = new EnvironmentConfig();
   ec.setAllowCreate(true);
   ec.setInitializeCache(true);
   ec.setInitializeLocking(true);
   ec.setInitializeLogging(true);
   ec.setInitializeReplication(true);
   ec.setTransactional(true);
   ec.setReplicationManagerAckPolicy(ReplicationManagerAckPolicy.ALL);
   ec.setRunRecovery(true);
   ec.setThreaded(true);
   if (Boolean.getBoolean("VERB_REPLICATION")) ec.setVerbose(VerboseConfig.REPLICATION, true);
   return (ec);
 }
 @Test
 public void eventBusElementTrueMBeans() {
   BeanDefinition beanDefinition = beanFactory.getBeanDefinition("eventBusTrueMBeans");
   assertNotNull("Bean definition not created", beanDefinition);
   assertEquals(
       "Wrong bean class", SimpleEventBus.class.getName(), beanDefinition.getBeanClassName());
   assertEquals(
       "wrong amount of constructor arguments",
       1,
       beanDefinition.getConstructorArgumentValues().getArgumentCount());
   Object constructorValue =
       beanDefinition.getConstructorArgumentValues().getArgumentValue(0, Boolean.class).getValue();
   assertTrue("constructor value is wrong", Boolean.parseBoolean((String) constructorValue));
   SimpleEventBus eventBus = beanFactory.getBean("eventBusTrueMBeans", SimpleEventBus.class);
   assertNotNull(eventBus);
 }
  @Test
  public void actualizarCategoria() {

    String catLeida = JOptionPane.showInputDialog("digite la caegoria a actualizar");
    String catLeidaValor = JOptionPane.showInputDialog("digite el valor");

    categoria.setIdCategoria(Integer.parseInt(catLeida));
    categoria.setActiva(Boolean.valueOf(catLeidaValor));

    em = EntityManagerHelper.getEntityManager();
    EntityManagerHelper.beginTransaction();
    em.merge(categoria);
    EntityManagerHelper.commit();
    EntityManagerHelper.closeEntityManager();
    EntityManagerHelper.closeEntityManagerFactory();
  }
  static void assertHeaders(Message message, Operation op) throws JMSException {
    Object map = op.get(MESSAGE_HEADERS);

    assertNotNull(map);
    assertTrue(map instanceof OperationMap);

    OperationMap opMap = (OperationMap) map;

    assertEquals(CORRELATION_ID, message.getJMSCorrelationID(), opMap.get(CORRELATION_ID));
    assertEquals(
        DELIVERY_MODE,
        getDeliveryMode(message.getJMSDeliveryMode()).getLabel(),
        opMap.get(DELIVERY_MODE));
    assertEquals(EXPIRATION, Long.valueOf(message.getJMSExpiration()), opMap.get(EXPIRATION));
    assertEquals(MESSAGE_ID, message.getJMSMessageID(), opMap.get(MESSAGE_ID));
    assertEquals(PRIORITY, Integer.valueOf(message.getJMSPriority()), opMap.get(PRIORITY));
    assertEquals(REDELIVERED, Boolean.valueOf(message.getJMSRedelivered()), opMap.get(REDELIVERED));
  }
 private boolean isColumnTaggedAsReadonly(
     org.talend.core.model.metadata.builder.connection.MetadataTable table, String columnName) {
   if (table == null || columnName == null) {
     return false;
   }
   EList<org.talend.core.model.metadata.builder.connection.MetadataColumn> columns =
       table.getColumns();
   for (org.talend.core.model.metadata.builder.connection.MetadataColumn newColumn : columns) {
     if (columnName.equals(newColumn.getLabel())) {
       EList<TaggedValue> taggedValues = newColumn.getTaggedValue();
       for (TaggedValue taggedValue : taggedValues) {
         if (DiSchemaConstants.TALEND6_IS_READ_ONLY.equals(taggedValue.getTag())) {
           return Boolean.valueOf(taggedValue.getValue());
         }
       }
     }
   }
   return false;
 }
Esempio n. 18
0
  @Test
  public void killTopologyWhileAuthenticated() {
    final String requestTopologyId = "topology-test";
    final int requestWaitTimeSecs = 10;
    final boolean async = true;

    doNothing()
        .when(topologyServiceMock)
        .killTopology(requestTopologyId, requestWaitTimeSecs, async, TEST_SUBJECT_ID);

    mockAuthenticatedSubject();

    ClientResponse clientResponse =
        resource()
            .path("/api/topologies/" + requestTopologyId + "/kill")
            .queryParam("waitTimeSecs", Integer.toString(requestWaitTimeSecs))
            .queryParam("async", Boolean.toString(async))
            .get(ClientResponse.class);

    assertEquals("Response HTTP status code should be 200 (OK)", clientResponse.getStatus(), 200);

    verify(topologyServiceMock)
        .killTopology(requestTopologyId, requestWaitTimeSecs, async, TEST_SUBJECT_ID);
  }
  @Test
  public void testOverlapsCRS() throws NoSuchIdentifierException, ProcessException {

    GeometryFactory fact = new GeometryFactory();

    // Inputs first
    final LinearRing ring =
        fact.createLinearRing(
            new Coordinate[] {
              new Coordinate(0.0, 0.0),
              new Coordinate(0.0, 10.0),
              new Coordinate(5.0, 10.0),
              new Coordinate(5.0, 0.0),
              new Coordinate(0.0, 0.0)
            });

    final Geometry geom1 = fact.createPolygon(ring, null);

    final LinearRing ring2 =
        fact.createLinearRing(
            new Coordinate[] {
              new Coordinate(-5.0, 0.0),
              new Coordinate(-5.0, 10.0),
              new Coordinate(2.0, 10.0),
              new Coordinate(2.0, 0.0),
              new Coordinate(-5.0, 0.0)
            });

    Geometry geom2 = fact.createPolygon(ring2, null);

    CoordinateReferenceSystem crs1 = null;
    try {
      crs1 = CRS.decode("EPSG:4326");
      JTS.setCRS(geom1, crs1);
    } catch (FactoryException ex) {
      Logger.getLogger(UnionProcess.class.getName()).log(Level.SEVERE, null, ex);
    }

    CoordinateReferenceSystem crs2 = null;
    try {
      crs2 = CRS.decode("EPSG:4326");
      JTS.setCRS(geom2, crs2);
    } catch (FactoryException ex) {
      Logger.getLogger(UnionProcess.class.getName()).log(Level.SEVERE, null, ex);
    }

    // Process
    final ProcessDescriptor desc = ProcessFinder.getProcessDescriptor("jts", "overlaps");

    final ParameterValueGroup in = desc.getInputDescriptor().createValue();
    in.parameter("geom1").setValue(geom1);
    in.parameter("geom2").setValue(geom2);
    final org.geotoolkit.process.Process proc = desc.createProcess(in);

    // result
    final Boolean result = (Boolean) proc.call().parameter("result").getValue();

    MathTransform mt = null;
    try {
      mt = CRS.findMathTransform(crs2, crs1);
      geom2 = JTS.transform(geom2, mt);
    } catch (FactoryException ex) {
      Logger.getLogger(UnionProcess.class.getName()).log(Level.SEVERE, null, ex);
    } catch (TransformException ex) {
      Logger.getLogger(UnionProcess.class.getName()).log(Level.SEVERE, null, ex);
    }

    final Boolean expected = geom1.overlaps(geom2);

    assertTrue(expected.equals(result));
  }
Esempio n. 20
0
 public CreoleParseTest(File creoleFile, File htmlExpectFile, File htmlFile, Boolean doSucceed) {
   this.creoleFile = creoleFile;
   this.htmlExpectFile = htmlExpectFile;
   this.htmlFile = htmlFile;
   shouldSucceed = doSucceed.booleanValue();
 }
Esempio n. 21
0
 public void testMain() throws Exception {
   Logger.global.addHandler(new BlockingHandler());
   Parallel.main(null);
   if (Boolean.getBoolean("no.failures")) return;
   fail("Ok, just print the logged output");
 }
Esempio n. 22
0
 public GitChangeSetEuroTest(String useAuthorName) {
   this.useAuthorName = Boolean.valueOf(useAuthorName);
 }
  protected MilitaryCensusRequest fillMeARequest() {
    MilitaryCensusRequest request = new MilitaryCensusRequest();

    request.setFatherBirthDepartment(InseeDepartementCodeType.NONE);

    request.setChildProfession("ChildProfession");

    request.setChildStatus(FamilyStatusType.MARRIED);

    request.setAliveChildren(BigInteger.valueOf(1));

    request.setAffectionOrDisease(Boolean.valueOf(true));

    request.setStatePupil(Boolean.valueOf(true));

    request.setChildTitle(TitleType.MISTER);

    request.setChildMail("ChildMail");

    request.setChildDiploma(ChildDiplomaType.B_A_C);

    request.setMotherBirthCountry(CountryType.UNKNOWN);

    request.setFatherBirthCity("FatherBirthCity");

    request.setFatherBirthDate(new Date());

    if ("FatherFirstName".length() > 38)
      request.setFatherFirstName("FatherFirstName".substring(0, 38));
    else request.setFatherFirstName("FatherFirstName");

    request.setMotherBirthCity("MotherBirthCity");

    request.setFatherNationality(FullNationalityType.NONE);

    request.setMotherBirthDate(new Date());

    if ("MotherFirstName".length() > 38)
      request.setMotherFirstName("MotherFirstName".substring(0, 38));
    else request.setMotherFirstName("MotherFirstName");

    request.setChildBirthCountry(CountryType.UNKNOWN);

    request.setMotherNationality(FullNationalityType.NONE);

    request.setHighlyInfirm(Boolean.valueOf(true));

    request.setChildSpeciality("ChildSpeciality");

    request.setChildOtherCountry(FullNationalityType.NONE);

    request.setChildrenInCharge(BigInteger.valueOf(1));

    request.setJapdExemption(Boolean.valueOf(true));

    request.setChildSituation(ChildSituationType.COLLEGE);

    if ("MaidenName".length() > 38) request.setMaidenName("MaidenName".substring(0, 38));
    else request.setMaidenName("MaidenName");

    if ("ChildPhone".length() > 10) request.setChildPhone("ChildPhone".substring(0, 10));
    else request.setChildPhone("ChildPhone");

    if ("MotherLastName".length() > 38)
      request.setMotherLastName("MotherLastName".substring(0, 38));
    else request.setMotherLastName("MotherLastName");

    if ("FatherLastName".length() > 38)
      request.setFatherLastName("FatherLastName".substring(0, 38));
    else request.setFatherLastName("FatherLastName");

    request.setPrefectPupilDepartment(InseeDepartementCodeType.NONE);

    request.setMotherBirthDepartment(InseeDepartementCodeType.NONE);

    request.setChildResidenceCountry(CountryType.UNKNOWN);

    request.setOtherSituation("OtherSituation");

    request.setPrefectPupil(Boolean.valueOf(true));

    request.setChildCountry(FullNationalityType.NONE);

    if ("ChildConvention".length() > 255)
      request.setChildConvention("ChildConvention".substring(0, 255));
    else request.setChildConvention("ChildConvention");

    request.setFatherBirthCountry(CountryType.UNKNOWN);

    // Means Of Contact
    MeansOfContact meansOfContact =
        meansOfContactService.getMeansOfContactByType(MeansOfContactEnum.EMAIL);
    request.setMeansOfContact(meansOfContact);
    MilitaryCensusRequestFeeder.feed(request);
    return request;
  }
Esempio n. 24
0
  /**
   * This sets up a Bitronix PoolingDataSource.
   *
   * @return PoolingDataSource that has been set up but _not_ initialized.
   */
  public static PoolingDataSource setupPoolingDataSource(
      Properties dsProps, String datasourceName, boolean startServer) {
    PoolingDataSource pds = new PoolingDataSource();

    // The name must match what's in the persistence.xml!
    pds.setUniqueName(datasourceName);

    pds.setClassName(dsProps.getProperty("className"));

    pds.setMaxPoolSize(Integer.parseInt(dsProps.getProperty("maxPoolSize")));
    pds.setAllowLocalTransactions(
        Boolean.parseBoolean(dsProps.getProperty("allowLocalTransactions")));
    for (String propertyName : new String[] {"user", "password"}) {
      pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
    }

    String driverClass = dsProps.getProperty("driverClassName");
    if (driverClass.startsWith("org.h2")) {
      if (startServer) {
        h2Server.start();
      }
      for (String propertyName : new String[] {"url", "driverClassName"}) {
        pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
      }
    } else {
      pds.setClassName(dsProps.getProperty("className"));

      if (driverClass.startsWith("oracle")) {
        pds.getDriverProperties().put("driverType", "thin");
        pds.getDriverProperties().put("URL", dsProps.getProperty("url"));
      } else if (driverClass.startsWith("com.ibm.db2")) {
        // http://docs.codehaus.org/display/BTM/JdbcXaSupportEvaluation#JdbcXaSupportEvaluation-IBMDB2
        pds.getDriverProperties().put("databaseName", dsProps.getProperty("databaseName"));
        pds.getDriverProperties().put("driverType", "4");
        pds.getDriverProperties().put("serverName", dsProps.getProperty("serverName"));
        pds.getDriverProperties().put("portNumber", dsProps.getProperty("portNumber"));
      } else if (driverClass.startsWith("com.microsoft")) {
        for (String propertyName : new String[] {"serverName", "portNumber", "databaseName"}) {
          pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
        }
        pds.getDriverProperties().put("URL", dsProps.getProperty("url"));
        pds.getDriverProperties().put("selectMethod", "cursor");
        pds.getDriverProperties().put("InstanceName", "MSSQL01");
      } else if (driverClass.startsWith("com.mysql")) {
        for (String propertyName :
            new String[] {"databaseName", "serverName", "portNumber", "url"}) {
          pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
        }
      } else if (driverClass.startsWith("com.sybase")) {
        for (String propertyName : new String[] {"databaseName", "portNumber", "serverName"}) {
          pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
        }
        pds.getDriverProperties().put("REQUEST_HA_SESSION", "false");
        pds.getDriverProperties().put("networkProtocol", "Tds");
      } else if (driverClass.startsWith("org.postgresql")) {
        for (String propertyName : new String[] {"databaseName", "portNumber", "serverName"}) {
          pds.getDriverProperties().put(propertyName, dsProps.getProperty(propertyName));
        }
      } else {
        throw new RuntimeException("Unknown driver class: " + driverClass);
      }
    }

    return pds;
  }