javax.sql.rowset.serial.SerialException Java Examples

The following examples show how to use javax.sql.rowset.serial.SerialException. 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 File: DBHandlerTest.java    From kardio with 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 File: DBQueryUtilTest.java    From kardio with 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 File: SerialExceptionTests.java    From jdk8u60 with 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 File: SerialBlobTests.java    From jdk8u_jdk with 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 File: DBQueryUtilTest.java    From kardio with 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
Source File: SerialExceptionTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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
Source File: SerialExceptionTests.java    From TencentKona-8 with 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 #8
Source File: SerialExceptionTests.java    From hottub with 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 File: DBQueryUtilTest.java    From kardio with 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 File: DBQueryUtilTest.java    From kardio with 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 File: SetAsciiStream.java    From jdk8u-dev-jdk with 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 File: SetBinaryStream.java    From jdk8u60 with 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 File: SerialExceptionTests.java    From jdk8u60 with 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
Source File: SetAsciiStream.java    From openjdk-8-source with 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 #15
Source File: SerialJavaObjectTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
@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
Source File: SerialJavaObjectTests.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@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
Source File: SetBinaryStream.java    From openjdk-8-source with 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 #18
Source File: SetAsciiStream.java    From jdk8u-jdk with 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
Source File: SerialExceptionTests.java    From jdk8u-jdk with 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 #20
Source File: SerialClobTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test05() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.truncate(1);
}
 
Example #21
Source File: SerialClobTests.java    From jdk8u60 with 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
Source File: SerialClobTests.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test16() throws Exception {
    SerialClob sc = new SerialClob(chars);
    sc.getCharacterStream(1, 100);
}
 
Example #23
Source File: SerialClobTests.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test06() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.getAsciiStream();
}
 
Example #24
Source File: SerialBlobTests.java    From jdk8u_jdk with 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
Source File: SerialClobTests.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test11() throws Exception {
    SerialClob sc = new SerialClob(new StubClob());
    sc.free();
    sc.setCharacterStream(5);
}
 
Example #26
Source File: SerialClobTests.java    From jdk8u60 with 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
Source File: SerialArrayTests.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test11() throws Exception {
    SerialArray sa = new SerialArray(a);
    sa.free();
    sa.getBaseType();
}
 
Example #28
Source File: SerialBlobTests.java    From openjdk-jdk9 with 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
Source File: SerialBlobTests.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(expectedExceptions = SerialException.class)
public void test01() throws Exception {
    SerialBlob sb = new SerialBlob(new StubBlob());
    sb.free();
    sb.getBinaryStream();
}
 
Example #30
Source File: SerialBlobTests.java    From openjdk-jdk9 with 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);
}