@Test public void testSerializable() throws Exception { final GDSServerVersion version = GDSServerVersion.parseRawVersion(TEST_VERSION_21); // Serialize object ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream objectOut = new ObjectOutputStream(out); objectOut.writeObject(version); // Deserialize object ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); ObjectInputStream objectIn = new ObjectInputStream(in); GDSServerVersion serializedVersion = (GDSServerVersion) objectIn.readObject(); assertEquals("Serialized version should be equal to original", version, serializedVersion); }
/** Check if version with a number in the platform (ie Sparc 4) is correctly parsed */ @Test public void testParseSparcVersion() throws Exception { GDSServerVersion version = GDSServerVersion.parseRawVersion(TEST_NO_EXTENDED_INFO_SPARC); assertEquals("S4", version.getPlatform()); assertEquals("V", version.getType()); assertEquals(2, version.getMajorVersion()); assertEquals(1, version.getMinorVersion()); assertEquals(3, version.getVariant()); assertEquals(18185, version.getBuildNumber()); assertEquals("Firebird 2.1", version.getServerName()); assertEquals(null, version.getExtendedServerName()); assertEquals("S4-V2.1.3.18185", version.getFullVersion()); }
@Test public void testParse21() throws Exception { GDSServerVersion version = GDSServerVersion.parseRawVersion(TEST_VERSION_21); assertEquals("WI", version.getPlatform()); assertEquals("V", version.getType()); assertEquals(2, version.getMajorVersion()); assertEquals(1, version.getMinorVersion()); assertEquals(3, version.getVariant()); assertEquals(18185, version.getBuildNumber()); assertEquals("Firebird 2.1", version.getServerName()); assertEquals("WI-V2.1.3.18185 Firebird 2.1/tcp (Ramona)/P10", version.getExtendedServerName()); assertEquals("WI-V2.1.3.18185", version.getFullVersion()); }
@Test public void testParse15() throws Exception { GDSServerVersion version = GDSServerVersion.parseRawVersion(TEST_VERSION_15); assertEquals("WI", version.getPlatform()); assertEquals("V", version.getType()); assertEquals(1, version.getMajorVersion()); assertEquals(5, version.getMinorVersion()); assertEquals(2, version.getVariant()); assertEquals(4731, version.getBuildNumber()); assertEquals("Firebird 1.5", version.getServerName()); assertEquals("WI-V1.5.2.4731 Firebird 1.5/tcp (PCRORO)/P10", version.getExtendedServerName()); assertEquals("WI-V1.5.2.4731", version.getFullVersion()); }
@Test(expected = GDSServerVersionException.class) public void testIncorrectFormat() throws Exception { GDSServerVersion.parseRawVersion(TEST_INCORRECT_FORMAT); }