/**
* Creates a new <code>FailedProperties40</code> instance. Since
* Derby doesn't support any properties,all the keys from the
* <code>props</code> parameter are added to the
* <code>FailedProps_</code> member with value
* REASON_UNKNowN_PROPERTY.
*
* @param props a <code>Properties</code> value. Can be null or empty
*/
public FailedProperties40(Properties props) {
if (props == null || props.isEmpty()) {
firstKey_ = null;
firstValue_ = null;
return;
}
Enumeration e = props.keys();
firstKey_ = (String)e.nextElement();
firstValue_ = props.getProperty(firstKey_);
FailedProps_.put(firstKey_,ClientInfoStatus.REASON_UNKNowN_PROPERTY);
while (e.hasMoreElements()) {
FailedProps_.put((String)e.nextElement(),ClientInfoStatus.REASON_UNKNowN_PROPERTY);
}
}
项目:gemfirexd-oss
文件:ClientConnection.java
/**
* <code>setClientInfo</code> will throw a <code>sqlClientInfoException</code>
* uless the <code>properties</code> paramenter is empty,since GemFireXD does
* not support any properties.
*/
@Override
public void setClientInfo(Properties properties)
throws sqlClientInfoException {
if (properties != null && !properties.isEmpty()) {
HashMap<String,ClientInfoStatus> FailedProperties =
new HashMap<String,ClientInfoStatus>(properties.size());
String firstKey = null;
for (String key : properties.stringPropertyNames()) {
if (firstKey == null) {
firstKey = key;
}
FailedProperties.put(key,ClientInfoStatus.REASON_UNKNowN_PROPERTY);
}
throw ThriftExceptionUtil.newsqlClientInfoException(
sqlState.PROPERTY_UNSUPPORTED_CHANGE,FailedProperties,null,firstKey,properties.getProperty(firstKey));
}
}
/**
* Creates a new <code>FailedProperties40</code> instance. Since
* Derby doesn't support any properties,all the keys from the
* <code>props</code> parameter are added to the
* <code>FailedProps_</code> member with value
* REASON_UNKNowN_PROPERTY.
*
* @param props a <code>Properties</code> value. Can be null or empty
*/
public FailedProperties40(Properties props) {
if (props == null || props.isEmpty()) {
firstKey_ = null;
firstValue_ = null;
return;
}
Enumeration e = props.keys();
firstKey_ = (String)e.nextElement();
firstValue_ = props.getProperty(firstKey_);
FailedProps_.put(firstKey_,ClientInfoStatus.REASON_UNKNowN_PROPERTY);
}
}
/**
* @tests java.sql.sqlClientInfoException#sqlClientInfoException(Map<String,ClientInfoStatus>)
*/
public void test_Constructor_LMap() {
Map<String,ClientInfoStatus> FailedProperties = new HashMap<String,ClientInfoStatus>();
FailedProperties.put("String1",ClientInfoStatus.REASON_VALUE_INVALID);
FailedProperties
.put("String2",ClientInfoStatus.REASON_VALUE_TruncATED);
sqlClientInfoException sqlClientInfoException = new sqlClientInfoException(
FailedProperties);
assertNull("The sqlState of sqlClientInfoException should be null",sqlClientInfoException.getsqlState());
assertNull("The reason of sqlClientInfoException should be null",sqlClientInfoException.getMessage());
assertEquals(
"The FailedProperties of sqlClientInfoException set and get should be equivalent",sqlClientInfoException.getFailedProperties());
assertEquals("The error code of sqlClientInfoException should be 0",sqlClientInfoException.getErrorCode(),0);
}
/**
* @tests java.sql.sqlClientInfoException#sqlClientInfoException(String,Map<String,ClientInfoStatus>)
*/
public void test_Constructor_LStringLMap() {
Map<String,ClientInfoStatus.REASON_VALUE_TruncATED);
sqlClientInfoException sqlClientInfoException = new sqlClientInfoException(
"Message",FailedProperties);
assertNull("The sqlState of sqlClientInfoException should be null",sqlClientInfoException.getsqlState());
assertEquals(
"The reason of sqlClientInfoException set and get should be equivalent","Message",0);
}
/**
* @tests java.sql.sqlClientInfoException#sqlClientInfoException(String,ClientInfoStatus>,Throwable)
*/
public void test_Constructor_LStringLMaplthrowable() {
Map<String,ClientInfoStatus.REASON_VALUE_TruncATED);
Throwable cause = new RuntimeException("Message");
sqlClientInfoException sqlClientInfoException = new sqlClientInfoException(
"Message",cause);
assertNull("The sqlState of sqlClientInfoException should be null",0);
assertEquals(
"The cause of sqlClientInfoException set and get should be equivalent",cause,sqlClientInfoException.getCause());
}
/**
* @tests java.sql.sqlClientInfoException#sqlClientInfoException(String,String,ClientInfoStatus>)
*/
public void test_Constructor_LStringLStringLMap() {
Map<String,"State",FailedProperties);
assertEquals(
"The sqlState of sqlClientInfoException set and get should be equivalent",Throwable)
*/
public void test_Constructor_LStringLStringLMaplthrowable() {
Map<String,cause);
assertEquals(
"The sqlState of sqlClientInfoException set and get should be equivalent",sqlClientInfoException.getCause());
}
/**
* @tests java.sql.sqlClientInfoException#sqlClientInfoException(String,int,Throwable)
*/
public void test_Constructor_LStringLStringILMaplthrowable() {
Map<String,1,sqlClientInfoException.getFailedProperties());
assertEquals("The error code of sqlClientInfoException should be 1",1);
assertEquals(
"The cause of sqlClientInfoException set and get should be equivalent",sqlClientInfoException.getCause());
}
public void setClientInfo(String name,String value) throws sqlClientInfoException {
try {
validate();
} catch (sqlException e) {
throw new sqlClientInfoException(e.getMessage(),e.getsqlState(),e.getErrorCode(),(Map<String,ClientInfoStatus>) null,e);
}
this.getConnection().setClientInfo(name,value);
}
项目:s-store
文件:BaseConnectionWrapper.java
public void setClientInfo(String name,value);
}
项目:s-store
文件:BaseConnectionWrapper.java
项目:gemfirexd-oss
文件:ThriftExceptionUtil.java
public static sqlClientInfoException newsqlClientInfoException(
String sqlState,ClientInfoStatus> FailedProperties,Throwable t,Object... args) {
return new sqlClientInfoException(getMessageUtil().getCompleteMessage(
sqlState,args),getsqlStateFromIdentifier(sqlState),getSeverityFromIdentifier(sqlState),t);
}
项目:gemfirexd-oss
文件:ClientConnection.java
/**
* <code>setClientInfo</code> will always throw a
* <code>sqlClientInfoException</code> since GemFireXD does not support any
* properties.
*/
@Override
public void setClientInfo(String name,String value)
throws sqlClientInfoException {
if (name != null || value != null) {
HashMap<String,ClientInfoStatus>(1);
if (name != null) {
FailedProperties.put(name,name,value);
}
}
项目:pljava
文件:SPIConnection.java
public void setClientInfo(Properties properties)
throws sqlClientInfoException
{
if (properties == null || properties.size() == 0)
return;
Map<String,ClientInfoStatus> failures = new HashMap<String,ClientInfoStatus>();
Iterator<String> i = properties.stringPropertyNames().iterator();
while (i.hasNext()) {
failures.put(i.next(),ClientInfoStatus.REASON_UNKNowN_PROPERTY);
}
throw new sqlClientInfoException("ClientInfo property not supported.",failures);
}
项目:VoltDB
文件:BaseConnectionWrapper.java
public void setClientInfo(String name,value);
}
项目:VoltDB
文件:BaseConnectionWrapper.java
项目:power-matchmaker
文件:TestingConnection.java
/**
* @tests java.sql.sqlClientInfoException#sqlClientInfoException(Map<String,Throwable)
*/
public void test_Constructor_LMaplthrowable() {
Map<String,ClientInfoStatus.REASON_VALUE_TruncATED);
Throwable cause = new RuntimeException("Message");
sqlClientInfoException sqlClientInfoException = new sqlClientInfoException(
FailedProperties,sqlClientInfoException.getsqlState());
assertEquals(
"The reason of sqlClientInfoException should be equals to cause.toString()","java.lang.RuntimeException: Message",sqlClientInfoException
.getMessage());
assertEquals(
"The FailedProperties of sqlClientInfoException set and get should be equivalent",sqlClientInfoException.getCause());
sqlClientInfoException = new sqlClientInfoException(FailedProperties,null);
assertNull("The sqlState of sqlClientInfoException should be null",0);
}
/**
* @tests serialization/deserialization compatibility with RI.
*/
public void testSerializationCompatibility() throws Exception {
Map<String,ClientInfoStatus.REASON_VALUE_TruncATED);
Throwable cause = new RuntimeException("Message");
SerializationTest.verifyGolden(this,new sqlClientInfoException(
"Message",cause),exComparator);
}
项目:pljava
文件:SPIConnection.java
项目:power-matchmaker
文件:TestingConnection.java
/**
* Creates a {@code sqlClientInfoException} for the specified {@code number}
* and the specified {@code parameter}.
*
* @param number
* the number of the exception to be created
* @param parameter
* the parameters to be replaced within the exception
*
* @return the created exception
*/
public static sqlClientInfoException createClientInfoException(
final int number,final String... parameter) {
final String msg = "[" + number + "] "
+ createMessage(number,parameter);
return new sqlClientInfoException(msg,number,Collections.<String,ClientInfoStatus> emptyMap());
}
/**
* <code>getProperties</code> provides a
* <code>Map<String,ClientInfoStatus></code> object describing the
* Failed properties (as specified in the javadoc for
* java.sql.sqlClientInfoException).
*
* @return a <code>Map<String,ClientInfoStatus></code> object with
* the Failed property keys and the reason why each Failed
*/
public Map<String,ClientInfoStatus> getProperties() { return FailedProps_; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。