本文整理汇总了Java中javax.sql.rowset.spi.SyncFactoryException类的典型用法代码示例。如果您正苦于以下问题:Java SyncFactoryException类的具体用法?Java SyncFactoryException怎么用?Java SyncFactoryException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SyncFactoryException类属于javax.sql.rowset.spi包,在下文中一共展示了SyncFactoryException类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test07
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test07() throws SyncFactoryException {
// Validate that only the default providers and any specified via
// a System property are available
validateProviders(initialProviders);
// Register a provider and make sure it is avaiable
SyncFactory.registerProvider(stubProvider);
validateProviders(allProviders);
// Check that if a provider is unregistered, it does not show as
// registered
SyncFactory.unregisterProvider(stubProvider);
validateProviders(initialProviders);
}
示例2: test04
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test04() {
SQLException ex = new SyncFactoryException("Exception 1");
ex.initCause(t1);
SyncFactoryException ex1 = new SyncFactoryException("Exception 2");
SyncFactoryException ex2 = new SyncFactoryException("Exception 3");
ex2.initCause(t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
while (ex != null) {
assertTrue(msgs[num++].equals(ex.getMessage()));
Throwable c = ex.getCause();
while (c != null) {
assertTrue(msgs[num++].equals(c.getMessage()));
c = c.getCause();
}
ex = ex.getNextException();
}
}
示例3: test_getInstance_Ljava_lang_String
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
/**
* Test method for
* {@link javax.sql.rowset.spi.SyncFactory#getInstance(java.lang.String)}.
*
* @throws SyncFactoryException
*/
public void test_getInstance_Ljava_lang_String()
throws SyncFactoryException {
Enumeration<SyncProvider> providers = SyncFactory
.getRegisteredProviders();
SyncProvider expected = providers.nextElement();
String id = expected.getProviderID();
SyncProvider provider = SyncFactory.getInstance(id);
assertEquals("getInstance error", expected.getVersion(), provider
.getVersion());
provider = SyncFactory.getInstance("nonExist");// should return default
assertNotNull(provider);
try {
provider = SyncFactory.getInstance(null);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
}
示例4: test_setLogger_Ljava_util_logging_LoggerLjava_util_logging_Level
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
/**
* Test method for
* {@link javax.sql.rowset.spi.SyncFactory#setLogger(java.util.logging.Logger, java.util.logging.Level)}
*
* @throws SyncFactoryException
*/
public void test_setLogger_Ljava_util_logging_LoggerLjava_util_logging_Level()
throws SyncFactoryException {
Logger logger = Logger.getAnonymousLogger();
Level level = Level.parse("WARNING");
SyncFactory.setLogger(logger, level);
Logger actual = SyncFactory.getLogger();
assertEquals("set logger or get logger error", logger, actual);
assertEquals("set logger error in set level", level, logger.getLevel());
try {
SyncFactory.setLogger(null, level);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
SyncFactory.setLogger(logger, null);
assertNull(SyncFactory.getLogger().getLevel());
}
示例5: test02
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test02() throws SyncFactoryException {
SyncProvider p = SyncFactory.getInstance("");
assertTrue(p instanceof RIOptimisticProvider);
// Attempt to get an invalid provider and get the default provider
p = SyncFactory.getInstance("util.InvalidSyncProvider");
assertTrue(p instanceof RIOptimisticProvider);
}
示例6: validateProviders
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
private void validateProviders(List<String> expectedProviders)
throws SyncFactoryException {
List<String> results = new ArrayList<>();
Enumeration<SyncProvider> providers = SyncFactory.getRegisteredProviders();
while (providers.hasMoreElements()) {
SyncProvider p = providers.nextElement();
results.add(p.getProviderID());
}
assertTrue(expectedProviders.containsAll(results)
&& results.size() == expectedProviders.size());
}
示例7: test01
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test01() {
SyncFactoryException ex = new SyncFactoryException();
assertTrue(ex.getMessage() == null
&& ex.getSQLState() == null
&& ex.getCause() == null
&& ex.getErrorCode() == 0);
}
示例8: test02
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test02() {
SyncFactoryException ex = new SyncFactoryException(reason);
assertTrue(ex.getMessage().equals(reason)
&& ex.getSQLState() == null
&& ex.getCause() == null
&& ex.getErrorCode() == 0);
}
示例9: test03
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test03() {
SyncFactoryException ex = new SyncFactoryException("Exception 1");
ex.initCause(t1);
SyncFactoryException ex1 = new SyncFactoryException("Exception 2");
SyncFactoryException ex2 = new SyncFactoryException("Exception 3");
ex2.initCause(t2);
ex.setNextException(ex1);
ex.setNextException(ex2);
int num = 0;
for (Throwable e : ex) {
assertTrue(msgs[num++].equals(e.getMessage()));
}
}
示例10: test05
import javax.sql.rowset.spi.SyncFactoryException; //导入依赖的package包/类
@Test
public void test05() throws Exception {
SyncFactoryException e = new SyncFactoryException(reason);
SyncFactoryException ex1 = createSerializedException(e);
assertTrue(ex1.getMessage().equals(reason)
&& ex1.getSQLState() == null
&& ex1.getCause() == null
&& ex1.getErrorCode() == 0);
}