indexing description: "Tests the module specification id" license: "MIT license (see ../../license.txt)" author: "Beat Strasser " date: "$Date$" revision: "$Revision$" deferred class TEST_MODULE_SPECIFICATION_ID inherit TS_TEST_CASE feature -- Tests test_make is -- Test make local msid: P2P_MODULE_SPECIFICATION_ID do create msid.make (tcuuid, tsuuid) validate (msid) end test_make_from_urn is -- Test make_from_urn local msid: P2P_MODULE_SPECIFICATION_ID do create msid.make_from_urn ("urn:jxta:uuid-" + tid) validate (msid) end validate (msid: P2P_MODULE_SPECIFICATION_ID) is -- Validate msid require Msid_valid: msid /= Void do assert_true ("is_valid", msid.is_valid) assert_equal ("format", "uuid", msid.format) assert_equal ("unique id", tid, msid.unique_id) assert_true ("unique id valid", msid.is_unique_id_valid (msid.unique_id)) assert_equal ("out", "urn:jxta:uuid-" + tid, msid.out) assert_equal ("out_short", "uuid-" + tid, msid.out_short) assert_equal ("flag id type", {NATURAL_8} 6, msid.flag_id_type) assert_equal ("specification uuid", tsuuid, msid.uuid) assert_equal ("class uuid", tcuuid, msid.base_class) end test_make_new_with_class is -- Test make_new_with_class local msid: P2P_MODULE_SPECIFICATION_ID do create msid.make_new_with_class (tcuuid) assert_true ("is_valid", msid.is_valid) assert_equal ("format", "uuid", msid.format) assert_equal ("unique id", tid.substring (1, 32), msid.unique_id.substring (1, 32)) assert_true ("unique id valid", msid.is_unique_id_valid (msid.unique_id)) assert_equal ("out", "urn:jxta:uuid-" + tid.substring (1, 32), msid.out.substring (1, 46)) assert_equal ("out_short", "uuid-" + tid.substring (1, 32), msid.out_short.substring (1, 37)) assert_equal ("flag id type", {NATURAL_8} 6, msid.flag_id_type) assert_equal ("class uuid", tcuuid, msid.base_class) assert_equal ("specification uuid", 16, msid.uuid.count) end test_base_class is -- Test baseclass comparison local msid1, msid2: P2P_MODULE_SPECIFICATION_ID tsuuid2, truuid: ARRAY [NATURAL_8] mcid: P2P_MODULE_CLASS_ID do create tsuuid2.make (0, 15) tsuuid2[0] := 1 create truuid.make (0, 15) create mcid.make (tcuuid, truuid) create msid1.make (tcuuid, tsuuid) create msid2.make (tcuuid, tsuuid2) assert_true ("has_same_baseclass", msid2.has_same_baseclass (msid1)) assert_true ("is_of_baseclass", msid1.is_of_baseclass (mcid)) end feature {NONE} -- Test data tid: STRING is "B6228B74806B456281AF9854A151F11DF592E37849884567B82EA12C0850E15B06" tcuuid: ARRAY [NATURAL_8] is -- Class UUID once Result := << 0x22, 0x8B, 0x74, 0x80, 0x6B, 0x45, 0x62, 0x81, 0xAF, 0x98, 0x54, 0xA1, 0x51, 0xF1, 0x1D >> Result.force (0xB6, 0) end tsuuid: ARRAY [NATURAL_8] is -- Specification UUID once Result := << 0x92, 0xE3, 0x78, 0x49, 0x88, 0x45, 0x67, 0xB8, 0x2E, 0xA1, 0x2C, 0x08, 0x50, 0xE1, 0x5B >> Result.force (0xF5, 0) end end