Java Code Examples for javax.sql.rowset.serial.SerialException

The following examples show how to use javax.sql.rowset.serial.SerialException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: kardio   Source File: DBHandlerTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testgetSurveillerStatus_NullParams() throws SerialException, SQLException {
	
	HealthCheckEntity hcv = daoService.createHealthCheckEntity(0, cte, region_id, TestDataProvider.getMesosPlatform());
	HealthCheckVO hcvo = new HealthCheckVO();
	
	Map<String,String> paramList = new HashMap<String,String>();
	paramList.put("DB-JDBC-URL",null);
	paramList.put("DB-USER",null);
	paramList.put("DB-PASSWORD","sa");
	paramList.put("DB-JDBC-DRIVER-CLASS","org.h2.Driver");
	paramList.put("DB-QUERY","test");
	paramList.put("DB-EXPECTED-VALUE","test");
	hcvo.setParamDetails(paramList);
	dbHandler.setHealthCheckVO(hcvo);
	dbHandler.init(hcvo);
    StatusVO result = dbHandler.getSurveillerStatus();
    dbHandler.run();
    HealthCheckVO resultVO= dbHandler.getHealthCheckVO();

}
 
Example 2
Source Project: kardio   Source File: DBQueryUtilTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testupdateApiDetails() throws SerialException, SQLException {
	String name = "apienv";
	EnvironmentEntity env = daoService.createEnvironment(name, 1,url);	
	
   
	String parentCompName="parentComp";
	String compName="testApiCompId";

	int numOfApi=10;
	int totApi=2;
	int del_ind=0;
	ComponentEntity ce=daoService.createComponent(compName,parentCompName,del_ind,cte,TestDataProvider.getMesosPlatform());
	ApiStatusEntity api = daoService.createApiStatusEntity(ce, env,totApi);
	DBQueryUtil.updateApiDetails(env.getEnvironmentId(), ce.getComponentName(), numOfApi,TestDataProvider.getMesosPlatform());	
	DBQueryUtil.updateApiDetails(env.getEnvironmentId(), "DUMMY", numOfApi,TestDataProvider.getMesosPlatform());
}
 
Example 3
Source Project: jdk8u60   Source File: SerialExceptionTests.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Test
public void test04() {
    SQLException ex = new SerialException("Exception 1");
    ex.initCause(t1);
    SerialException ex1 = new SerialException("Exception 2");
    SerialException ex2 = new SerialException("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();
    }
}
 
Example 4
Source Project: jdk8u_jdk   Source File: SerialBlobTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test19() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    sb.free();
    SerialBlob sb2 = (SerialBlob) sb.clone();
    InputStream is = sb2.getBinaryStream(1, 3);
}
 
Example 5
Source Project: kardio   Source File: DBQueryUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
    public void testGetAllEnvironments() throws SerialException, SQLException {
    	String name = "testallenv";
    	EnvironmentEntity env = daoService.createEnvironment(name, 1,url);
    	List<EnvironmentVO> result = DBQueryUtil.getAllEnvironments();
    	//Assert.assertEquals("Size does not match", TestDaoService.environmentID, result.size());
    	//EnvironmentVO actual = result.get(0);
    	
    	//Assert.assertEquals("ID does not match", TestDaoService.environmentID, actual.getEnvironmentId());
    	//Assert.assertEquals("Name does not match", env.getEnvironmentName(), actual.getEnvironmentName());
//    	Assert.assertEquals("Describtion does not match", env.getEnvironmentDesc(), actual.getMarathonJson());
    }
 
Example 6
@Test
public void test03() {
    SerialException ex = new SerialException("Exception 1");
    ex.initCause(t1);
    SerialException ex1 = new SerialException("Exception 2");
    SerialException ex2 = new SerialException("Exception 3");
    ex2.initCause(t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
Example 7
@Test
public void test02() {
    SerialException ex = new SerialException(reason);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0);
}
 
Example 8
Source Project: hottub   Source File: SerialExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test02() {
    SerialException ex = new SerialException(reason);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0);
}
 
Example 9
Source Project: kardio   Source File: DBQueryUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateMarathonHealthCheckStatus_StatusChangedTrue() throws SerialException, SQLException {
	String name = "testUpdateHC";
	EnvironmentEntity env = daoService.createEnvironment(name, 1,url);
	StatusEntity se = daoService.createStatus();
	se.setStatusId(2L);
	RegionEntity re = daoService.createRegionEntity();
	HealthCheckTypeEntity hte = daoService.createHeathCheckType();
	HealthCheckType hto=HealthCheckType.DUMMY;
	Status st=Status.UP;
	int del_ind=0;
	ComponentEntity ce = daoService.createComponent("testUHC", "testUHCP",del_ind,cte,TestDataProvider.getMesosPlatform());
	DBQueryUtil.updateMarathonHealthCheckStatus(ce.getComponentId(), env.getEnvironmentId(), re.getRegionId(), hto, st, true);
}
 
Example 10
Source Project: kardio   Source File: DBQueryUtilTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testLoadContainerStatus() throws SerialException, SQLException {
	String compName ="testLoadCont";
	String parentCompName = "testLoadContP";
	ContainerStatsEntity cse = daoService.createContainerStatsEntity(compName,parentCompName,cte,TestDataProvider.getMesosPlatform());
	DBQueryUtil.loadContainerStatus(cse.getEnvironment().getEnvironmentId(), cse.getComponent().getComponentId(), 5);
	Assert.assertEquals("Component ID not matching", cse.getComponent().getComponentId(),cse.getComponent().getComponentId());
	
	//Case 2 for invalid component Name
	DBQueryUtil.loadContainerStatus(1,1, 5);
	Assert.assertEquals("Component ID Available in DB", 1,1);
	
}
 
Example 11
Source Project: jdk8u-dev-jdk   Source File: SetAsciiStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    SerialClob clob = new SerialClob(new char[0]);
    try {
        clob.setAsciiStream(0);
    } catch (SerialException e) {
         System.out.println("Test PASSED");
    }
}
 
Example 12
Source Project: jdk8u60   Source File: SetBinaryStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    SerialBlob blob = new SerialBlob(new byte[0]);
    try {
        blob.setBinaryStream(0);
    } catch (SerialException e) {
        System.out.println("Test PASSED");
    }
}
 
Example 13
Source Project: jdk8u60   Source File: SerialExceptionTests.java    License: GNU General Public License v2.0 5 votes vote down vote up
@Test
public void test05() throws Exception {
    SerialException e = new SerialException(reason);
    SerialException ex1 = createSerializedException(e);
    assertTrue(ex1.getMessage().equals(reason)
            && ex1.getSQLState() == null
            && ex1.getCause() == null
            && ex1.getErrorCode() == 0);;
}
 
Example 14
public static void main(String[] args) throws Exception {
    SerialClob clob = new SerialClob(new char[0]);
    try {
        clob.setAsciiStream(0);
    } catch (SerialException e) {
         System.out.println("Test PASSED");
    }
}
 
Example 15
@Test
public void test02() throws Exception {
    SerialException e = new SerialException();
    SerialJavaObject sjo = new SerialJavaObject(e);
    Field[] f = e.getClass().getFields();
    assertTrue(Arrays.equals(f, sjo.getFields()));
    assertFalse(Arrays.equals("hello".getClass().getFields(),
            sjo.getFields()));
}
 
Example 16
@Test
public void test02() throws Exception {
    SerialException e = new SerialException();
    SerialJavaObject sjo = new SerialJavaObject(e);
    Field[] f = e.getClass().getFields();
    assertTrue(Arrays.equals(f, sjo.getFields()));
    assertFalse(Arrays.equals("hello".getClass().getFields(),
            sjo.getFields()));
}
 
Example 17
public static void main(String[] args) throws Exception {
    SerialBlob blob = new SerialBlob(new byte[0]);
    try {
        blob.setBinaryStream(0);
    } catch (SerialException e) {
        System.out.println("Test PASSED");
    }
}
 
Example 18
Source Project: jdk8u-jdk   Source File: SetAsciiStream.java    License: GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    SerialClob clob = new SerialClob(new char[0]);
    try {
        clob.setAsciiStream(0);
    } catch (SerialException e) {
         System.out.println("Test PASSED");
    }
}
 
Example 19
@Test
public void test02() {
    SerialException ex = new SerialException(reason);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0);
}
 
Example 20
@Test(expectedExceptions = SerialException.class)
public void test05() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.truncate(1);
}
 
Example 21
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test03() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.getCharacterStream(1, 5);
}
 
Example 22
@Test(expectedExceptions = SerialException.class)
public void test16() throws Exception {
    SerialClob sc = new SerialClob(chars);
    sc.getCharacterStream(1, 100);
}
 
Example 23
@Test(expectedExceptions = SerialException.class)
public void test06() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.getAsciiStream();
}
 
Example 24
Source Project: jdk8u_jdk   Source File: SerialBlobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test07() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.setBinaryStream(5);
}
 
Example 25
@Test(expectedExceptions = SerialException.class)
public void test11() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.setCharacterStream(5);
}
 
Example 26
Source Project: jdk8u60   Source File: SerialClobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test13() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.setString(1, "hello", 0, 5);
}
 
Example 27
@Test(expectedExceptions = SerialException.class)
public void test11() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getBaseType();
}
 
Example 28
Source Project: openjdk-jdk9   Source File: SerialBlobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test07() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.setBinaryStream(5);
}
 
Example 29
@Test(expectedExceptions = SerialException.class)
public void test01() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.getBinaryStream();
}
 
Example 30
Source Project: openjdk-jdk9   Source File: SerialBlobTests.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test14() throws Exception {
    SerialBlob sb = new SerialBlob(bytes);
    InputStream is = sb.getBinaryStream(0, 3);
}