当前位置: 首页>>代码示例>>Java>>正文


Java DriverPropertyInfo类代码示例

本文整理汇总了Java中java.sql.DriverPropertyInfo的典型用法代码示例。如果您正苦于以下问题:Java DriverPropertyInfo类的具体用法?Java DriverPropertyInfo怎么用?Java DriverPropertyInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DriverPropertyInfo类属于java.sql包,在下文中一共展示了DriverPropertyInfo类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: driverPropertyInfoWithoutValues

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
@Test
public void driverPropertyInfoWithoutValues() throws SQLException
{
	Driver driver = getDriver();
	DriverPropertyInfo[] properties = driver.getPropertyInfo("jdbc:cloudspanner://localhost", null);
	assertEquals(12, properties.length);
	for (DriverPropertyInfo property : properties)
	{
		if (property.name.equals("AllowExtendedMode") || property.name.equals("AsyncDdlOperations")
				|| property.name.equals("AutoBatchDdlOperations"))
			assertEquals("false", property.value);
		else if (property.name.equals("ReportDefaultSchemaAsNull"))
			assertEquals("true", property.value);
		else
			assertNull(property.value);
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:18,代码来源:CloudSpannerDriverTest.java

示例2: testPropertiesDescriptionsKeys

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
public void testPropertiesDescriptionsKeys() throws Exception {
    DriverPropertyInfo[] dpi = new NonRegisteringDriver().getPropertyInfo(dbUrl, null);

    for (int i = 0; i < dpi.length; i++) {
        String description = dpi[i].description;
        String propertyName = dpi[i].name;

        if (description.indexOf("Missing error message for key '") != -1 || description.startsWith("!")) {
            fail("Missing message for configuration property " + propertyName);
        }

        if (description.length() < 10) {
            fail("Suspiciously short description for configuration property " + propertyName);
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:17,代码来源:ConnectionRegressionTest.java

示例3: testBug22628

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
/**
 * Fix for BUG#22628 - Driver.getPropertyInfo() throws NullPointerException
 * for URL that only specifies host and/or port.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug22628() throws Exception {
    DriverPropertyInfo[] dpi = new NonRegisteringDriver().getPropertyInfo("jdbc:mysql://bogus:9999", new Properties());

    boolean foundHost = false;
    boolean foundPort = false;

    for (int i = 0; i < dpi.length; i++) {
        if ("bogus".equals(dpi[i].value)) {
            foundHost = true;
        }

        if ("9999".equals(dpi[i].value)) {
            foundPort = true;
        }
    }

    assertTrue(foundHost && foundPort);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:26,代码来源:MetaDataRegressionTest.java

示例4: getPropertyInfo

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
public DriverPropertyInfo[] getPropertyInfo(
    String url, Properties info) throws SQLException {
  List<DriverPropertyInfo> list = new ArrayList<DriverPropertyInfo>();

  // First, add the contents of info
  for (Map.Entry<Object, Object> entry : info.entrySet()) {
    list.add(
        new DriverPropertyInfo(
            (String) entry.getKey(),
            (String) entry.getValue()));
  }
  // Next, add property definitions not mentioned in info
  for (ConnectionProperty p : getConnectionProperties()) {
    if (info.containsKey(p.name())) {
      continue;
    }
    list.add(new DriverPropertyInfo(p.name(), null));
  }
  return list.toArray(new DriverPropertyInfo[list.size()]);
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:21,代码来源:UnregisteredDriver.java

示例5: testGetPropertyInfo

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
@Test(groups = {"unit", "base"})
public void testGetPropertyInfo() {
    CassandraDriver driver = new CassandraDriver();
    try {
        String url = "jdbc:c*:datastax://host1,host2/keyspace1?key=value";
        DriverPropertyInfo[] info = driver.getPropertyInfo(url, new Properties());
        assertNotNull(info);
        assertTrue(info.length > 1);

        for (DriverPropertyInfo i : info) {
            if (i.name.equals("consistencyLevel")) {
                assertNotNull(i.choices);
                assertTrue(i.choices.length > 1);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail("Exception happened during test: " + e.getMessage());
    }
}
 
开发者ID:zhicwu,项目名称:cassandra-jdbc-driver,代码行数:21,代码来源:CassandraDriverTest.java

示例6: testPropertiesDescriptionsKeys

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
public void testPropertiesDescriptionsKeys() throws Exception {
	DriverPropertyInfo[] dpi = new NonRegisteringDriver().getPropertyInfo(
			dbUrl, null);

	for (int i = 0; i < dpi.length; i++) {
		String description = dpi[i].description;
		String propertyName = dpi[i].name;

		if (description.indexOf("Missing error message for key '") != -1
				|| description.startsWith("!")) {
			fail("Missing message for configuration property "
					+ propertyName);
		}

		if (description.length() < 10) {
			fail("Suspiciously short description for configuration property "
					+ propertyName);
		}
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:21,代码来源:ConnectionRegressionTest.java

示例7: testBug22628

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
/**
 * Fix for BUG#22628 - Driver.getPropertyInfo() throws NullPointerException
 * for URL that only specifies host and/or port.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug22628() throws Exception {
	DriverPropertyInfo[] dpi = new NonRegisteringDriver().getPropertyInfo(
			"jdbc:mysql://bogus:9999", new Properties());

	boolean foundHost = false;
	boolean foundPort = false;

	for (int i = 0; i < dpi.length; i++) {
		if ("bogus".equals(dpi[i].value)) {
			foundHost = true;
		}

		if ("9999".equals(dpi[i].value)) {
			foundPort = true;
		}
	}

	assertTrue(foundHost && foundPort);
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:27,代码来源:MetaDataRegressionTest.java

示例8: getPropertyInfo

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
    if(info == null) {
        info = new Properties();
    } else {
    	info = PropertiesUtils.clone(info);
    }

    // construct list of driverPropertyInfo objects
    List<DriverPropertyInfo> driverProps = new LinkedList<DriverPropertyInfo>();

    parseURL(url, info);

    for (String property: JDBCURL.KNOWN_PROPERTIES.keySet()) {
    	DriverPropertyInfo dpi = new DriverPropertyInfo(property, info.getProperty(property));
    	if (property.equals(BaseDataSource.VDB_NAME)) {
    		dpi.required = true;
    	}
    	driverProps.add(dpi);
    }
    
    // create an array of DriverPropertyInfo objects
    DriverPropertyInfo [] propInfo = new DriverPropertyInfo[driverProps.size()];

    // copy the elements from the list to the array
    return driverProps.toArray(propInfo);
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:27,代码来源:TeiidDriver.java

示例9: test_getPropertyInfo_Required

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
/**
 * Tests that the {@link DriverPropertyInfo} array returned from
 * {@link Driver#getPropertyInfo(String, Properties)} contains
 * the correct <code>required</code> value on each of the objects.
 */
public void test_getPropertyInfo_Required() {

    Map requiredTrueMap = new HashMap();
    requiredTrueMap.put(Messages.get(Driver.SERVERNAME), Boolean.TRUE);
    requiredTrueMap.put(Messages.get(Driver.SERVERTYPE), Boolean.TRUE);

    final Map infoMap = new HashMap();
    loadDriverPropertyInfoMap(infoMap);

    final Iterator iterator = infoMap.keySet().iterator();
    while (iterator.hasNext()) {
        String key = (String) iterator.next();
        DriverPropertyInfo info = (DriverPropertyInfo) infoMap.get(key);
        if (requiredTrueMap.containsKey(key)) {
            assertTrue("The 'required' field is not true for key " + key, info.required);
        }
        else {
            assertFalse("The 'required' field is not false for key " + key, info.required);
        }
    }
}
 
开发者ID:milesibastos,项目名称:jTDS,代码行数:27,代码来源:DriverUnitTest.java

示例10: testPublicFields

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
public void testPublicFields() {

        // Constructor here...
        DriverPropertyInfo aDriverPropertyInfo = new DriverPropertyInfo(
                validName, validValue);

        assertTrue(Arrays.equals(testChoices, aDriverPropertyInfo.choices));
        assertEquals(testValue, aDriverPropertyInfo.value);
        assertEquals(testRequired, aDriverPropertyInfo.required);
        assertEquals(testDescription, aDriverPropertyInfo.description);
        assertEquals(testName, aDriverPropertyInfo.name);

        aDriverPropertyInfo.choices = updateChoices;
        aDriverPropertyInfo.value = updateValue;
        aDriverPropertyInfo.required = updateRequired;
        aDriverPropertyInfo.description = updateDescription;
        aDriverPropertyInfo.name = updateName;

        assertTrue(Arrays.equals(updateChoices, aDriverPropertyInfo.choices));
        assertEquals(updateValue, aDriverPropertyInfo.value);
        assertEquals(updateRequired, aDriverPropertyInfo.required);
        assertEquals(updateDescription, aDriverPropertyInfo.description);
        assertEquals(updateName, aDriverPropertyInfo.name);

    }
 
开发者ID:shannah,项目名称:cn1,代码行数:26,代码来源:DriverPropertyInfoTest.java

示例11: getPropertyInfo

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
{
	if (!acceptsURL(url))
		return new DriverPropertyInfo[0];
	ConnectionProperties properties = ConnectionProperties.parse(url);
	properties.setAdditionalConnectionProperties(info);

	return properties.getPropertyInfo();
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:11,代码来源:CloudSpannerDriver.java

示例12: driverPropertyInfoWithURLValues

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
@Test
public void driverPropertyInfoWithURLValues() throws SQLException
{
	Driver driver = getDriver();
	DriverPropertyInfo[] properties = driver.getPropertyInfo(
			"jdbc:cloudspanner://localhost;Project=adroit-hall-xxx;Instance=test-instance;Database=testdb;PvtKeyPath=C:\\Users\\MyUserName\\Documents\\CloudSpannerKeys\\cloudspanner3.json;SimulateProductName=PostgreSQL",
			null);
	assertEquals(12, properties.length);
	assertEquals("adroit-hall-xxx", properties[0].value);
	assertEquals("test-instance", properties[1].value);
	assertEquals("testdb", properties[2].value);
	assertEquals("C:\\Users\\MyUserName\\Documents\\CloudSpannerKeys\\cloudspanner3.json", properties[3].value);
	assertNull(properties[4].value);
	assertEquals("PostgreSQL", properties[5].value);
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:16,代码来源:CloudSpannerDriverTest.java

示例13: getPropertyInfos

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
private DriverPropertyInfo[] getPropertyInfos() {
    try {
        String e = this.hostTextField.getText();
        if(e == null || "".equals(e)) {
            e = "192.168.0.0";
        }

        String port = this.portTextField.getText();
        if(port == null || "".equals(port)) {
            port = "1234";
        }

        String db = this.databaseTextField.getText();
        if(db == null || "".equals(db)) {
            db = "test";
        }

        String prop = this.propertyTextField.getText();
        if (prop == null || "".equals(prop)) {
            prop = "";
        }

        String driverURL = FieldConnectionEntry.createURL(this.getJDBCProperties(), e, port, db, prop);
        Driver driver = DriverManager.getDriver(driverURL);
        Properties givenProperties = this.currentlyEditedEntry.getConnectionProperties();
        DriverPropertyInfo[] propertyInfo = driver.getPropertyInfo(driverURL, givenProperties);
        if(propertyInfo == null) {
            propertyInfo = new DriverPropertyInfo[0];
        }

        return propertyInfo;
    } catch (SQLException var8) {
        LogService.getRoot().log(Level.SEVERE, "com.rapidminer.gui.tools.dialogs.DatabaseConnectionDialog.loading_jdbc_driver_properties_error", var8);
        return null;
    }
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:37,代码来源:DatabaseConnectionDialog.java

示例14: DriverPropertyInfoTableModel

import java.sql.DriverPropertyInfo; //导入依赖的package包/类
private DriverPropertyInfoTableModel(DriverPropertyInfo[] propInfo, Properties currentProperties) {
    this.propInfo = propInfo;
    this.override = new ArrayList(propInfo.length);

    for(int i = 0; i < this.propInfo.length; ++i) {
        if(currentProperties.get(propInfo[i].name) != null) {
            this.override.add(Boolean.valueOf(true));
        } else {
            this.override.add(Boolean.valueOf(false));
        }
    }

}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:14,代码来源:DatabaseAdvancedConnectionDialog.java


注:本文中的java.sql.DriverPropertyInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。