rtm-majortom 0.3.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,41 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module Java::DeTopicmapslabMajortomModelIndex::IRevisionIndex
7
+ describe self do
8
+ before(:each) do
9
+ @tm = get_used_tm_sys_tm
10
+ @tm.should be_a_kind_of RTM::TopicMap
11
+ end
12
+ after(:each) do
13
+ if implementation_for_spec == :majortom_db
14
+ @tm.remove
15
+ else
16
+ @tm.close
17
+ end
18
+ end
19
+
20
+ describe "#first_revision" do
21
+ it "should be callable on an index" do
22
+ index = @tm.revision_index
23
+ index.should_not be_nil
24
+ index.should respond_to(:first_revision)
25
+ end
26
+ end
27
+
28
+ describe "future" do
29
+ it "should be callable on the first revision" do
30
+ index = @tm.revision_index
31
+ index.should_not be_nil
32
+ first_revision = index.first_revision
33
+ first_revision.should be_nil
34
+ @tm.create_topic
35
+ first_revision = index.first_revision
36
+ first_revision.should_not be_nil
37
+ end
38
+ end
39
+
40
+ end # of describe self
41
+ end
@@ -0,0 +1,31 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module RTM::Revision
7
+ describe self do
8
+
9
+ describe "#specify_event" do
10
+ it "should give back a symbol if the type is known" do
11
+ RTM::Revision.specify_event(Type::ASSOCIATION_ADDED).should == :creation
12
+ end
13
+ it "should give back nil if the type is not known" do
14
+ RTM::Revision.specify_event(Type::UNKNOWN).should be_nil
15
+ end
16
+ end
17
+
18
+ end # of describe self
19
+ end
20
+
21
+ class RTM::Revision::Type
22
+ describe self do
23
+
24
+ describe "Enumeration" do
25
+ it "should let us call the constants in the enumeration" do
26
+ RTM::Revision::Type::TYPE_SET.to_s.should == "TYPE_SET"
27
+ end
28
+ end
29
+
30
+ end # of describe self
31
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module Java::DeTopicmapslabMajortomModelStore::ITopicMapStore
7
+ describe self do
8
+ before(:each) do
9
+ @tm = get_used_tm_sys_tm
10
+ @tm.should be_a_kind_of RTM::TopicMap
11
+ @store = @tm.store
12
+ @store.should_not be_nil
13
+ end
14
+ after(:each) do
15
+ if implementation_for_spec == :majortom_db
16
+ @tm.remove
17
+ else
18
+ @tm.close
19
+ end
20
+ end
21
+
22
+ describe "#is_revision_management_enabled" do
23
+ it "should give back true after initializing a topic map" do
24
+ @store.is_revision_management_enabled.should be_true
25
+ end
26
+ end
27
+
28
+ describe "#enable_revision_management" do
29
+ it "should enable and disable the revision management" do
30
+ @store.is_revision_management_enabled.should be_true
31
+ @store.enable_revision_management(true)
32
+ @store.is_revision_management_enabled.should be_true
33
+ @store.enable_revision_management(false)
34
+ @store.is_revision_management_enabled.should_not be_true
35
+ @store.enable_revision_management(true)
36
+ @store.is_revision_management_enabled.should be_true
37
+ end
38
+ end
39
+
40
+ end # of describe self
41
+ end
@@ -0,0 +1,116 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module RTM::TopicMap
7
+ describe self do
8
+ before(:each) do
9
+ @tm = get_used_tm_sys_tm
10
+ @tm.should be_a_kind_of RTM::TopicMap
11
+ end
12
+ after(:each) do
13
+ if implementation_for_spec == :majortom_db
14
+ @tm.remove
15
+ else
16
+ @tm.close
17
+ end
18
+ end
19
+
20
+ describe "#revision_index" do
21
+ it "should give an open revision index for a majortom map" do
22
+ index = @tm.revision_index
23
+ index.should be_a_kind_of Java::DeTopicmapslabMajortomModelIndex::IRevisionIndex
24
+ index.should be_open
25
+ end
26
+ end
27
+
28
+ describe "#supertype_subtype_index" do
29
+ it "should give an open supertype subtype index for a majortom map" do
30
+ index = @tm.supertype_subtype_index
31
+ index.should be_a_kind_of Java::DeTopicmapslabMajortomModelIndex::ISupertypeSubtypeIndex
32
+ index.should be_open
33
+ end
34
+ end
35
+
36
+ describe "#transitive_type_instance_index" do
37
+ it "should give an open transitive type instance index for a majortom map" do
38
+ index = @tm.transitive_type_instance_index
39
+ index.should be_a_kind_of Java::DeTopicmapslabMajortomModelIndex::ITransitiveTypeInstanceIndex
40
+ index.should be_open
41
+ end
42
+ end
43
+
44
+ describe "#remove_duplicates" do
45
+ it "should not raise an error" do
46
+ store = @tm.store
47
+ store.enable_revision_management(false)
48
+ store.is_revision_management_enabled.should_not be_true
49
+ if implementation_for_spec == :majortom_db
50
+ @tm.clear
51
+ end
52
+ @tm.topics.should be_empty
53
+ begin
54
+ @tm.from_xtm(File.dirname(__FILE__) + "/../../../rtm/spec/resources/toyTM.xtm")
55
+ rescue Exception => e
56
+ print_stack_trace(e)
57
+ raise(e.message)
58
+ end
59
+ @tm.topics.should_not be_empty
60
+ @tm.remove_duplicates
61
+ store.enable_revision_management(true)
62
+ store.is_revision_management_enabled.should be_true
63
+ end
64
+ end
65
+
66
+ describe "#store" do
67
+ it "should give back the store" do
68
+ store = @tm.store
69
+ store.should_not be_nil
70
+ store.should be_a_kind_of Java::DeTopicmapslabMajortomModelStore::ITopicMapStore
71
+ if implementation_for_spec == :majortom_db
72
+ store.should be_a_kind_of Java::DeTopicmapslabMajortomDatabaseStore::JdbcTopicMapStore
73
+ elsif implementation_for_spec == :majortom
74
+ store.should be_a_kind_of Java::DeTopicmapslabMajortomInmemoryStore::InMemoryTopicMapStore
75
+ end
76
+ end
77
+ end
78
+
79
+ describe "#clear" do
80
+ it "should disable the history, remove the history and clear the topic map" do
81
+ @tm.topics.should be_empty
82
+ revision_index = @tm.revision_index
83
+ revision_index.should_not be_nil
84
+ first_revision = revision_index.first_revision
85
+ first_revision.should be_nil
86
+ store = @tm.store
87
+ store.enable_revision_management(false)
88
+ store.is_revision_management_enabled.should_not be_true
89
+ begin
90
+ @tm.from_xtm(File.dirname(__FILE__) + "/../../../rtm/spec/resources/toyTM.xtm")
91
+ rescue Exception => e
92
+ print_stack_trace(e)
93
+ raise(e.message)
94
+ end
95
+ store.enable_revision_management(true)
96
+ store.is_revision_management_enabled.should be_true
97
+ first_revision = revision_index.first_revision
98
+ first_revision.should be_nil
99
+ @tm.get!("Topic")
100
+ first_revision = revision_index.first_revision
101
+ first_revision.should_not be_nil
102
+ @tm.clear
103
+ first_revision = revision_index.first_revision
104
+ first_revision.should be_nil
105
+ end
106
+ end
107
+
108
+ it "should not create type instance associations cause it is really slow" do
109
+ @tm.clear
110
+ @tm.should have(0).associations
111
+ @tm.get!("topic_a").add_type("topic_b")
112
+ @tm.should have(0).associations
113
+ end
114
+
115
+ end # of describe self
116
+ end
@@ -0,0 +1,50 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module RTM::Topic
7
+ describe self do
8
+ before(:each) do
9
+ @tm = get_used_tm_sys_tm
10
+ @tm.should be_a_kind_of RTM::TopicMap
11
+ end
12
+ after(:each) do
13
+ if implementation_for_spec == :majortom_db
14
+ @tm.remove
15
+ else
16
+ @tm.close
17
+ end
18
+ end
19
+
20
+ describe "#best_label" do
21
+ it "should be avaiable to majortom topics" do
22
+ t = @tm.get!("a_topic")
23
+ t.should be_a_kind_of RTM::Topic
24
+ t.should respond_to(:best_label)
25
+ end
26
+ end
27
+
28
+ describe "#read_only?" do
29
+ it "should give back true if topic is existing" do
30
+ topic = @tm.get!("something")
31
+ topic.should_not be_nil
32
+ topic.should be_a_kind_of RTM::Topic
33
+ topic.read_only?.should_not be_true
34
+ end
35
+ it "should give back fase if topic is removed" do
36
+ @tm.clear
37
+ @tm.disable_revision_management
38
+ topic = @tm.get!("something")
39
+ topic.should_not be_nil
40
+ topic.should be_a_kind_of RTM::Topic
41
+ @tm.enable_revision_management
42
+ topic.remove
43
+ topic = @tm.revision_index.first_revision.changeset.first.old_value
44
+ topic.should be_a_kind_of RTM::Topic
45
+ topic.read_only?.should be_true
46
+ end
47
+ end
48
+
49
+ end # of describe self
50
+ end
@@ -0,0 +1,54 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module RTM
7
+ class MaJorToM
8
+ describe self do
9
+ before(:each) do
10
+ @connection = get_used_tm_sys
11
+ end
12
+ after(:each) do
13
+ @connection.close
14
+ end
15
+ it "should have certain properties" do
16
+ @connection.property("de.topicmapslab.majortom.topicmapstore.class").should == "de.topicmapslab.majortom.database.store.JdbcTopicMapStore"
17
+ #@connection.property("de.topicmapslab.majortom.jdbc.database").should == "testdb"
18
+ #@connection.property("de.topicmapslab.majortom.jdbc.host").should == "nemo.tm.informatik.uni-leipzig.de"
19
+ #@connection.property("de.topicmapslab.majortom.jdbc.user").should == "tester"
20
+ #@connection.property("de.topicmapslab.majortom.jdbc.password").should == "_test!er$"
21
+ @connection.property("de.topicmapslab.majortom.jdbc.dialect").should == "POSTGRESQL99"
22
+ end
23
+ it "should connect to the test database" do
24
+ @connection.should be_a_kind_of RTM::Engine
25
+ @connection.should be_a_kind_of RTM::MaJorToM
26
+ end
27
+ it "should let us create a topic map" do
28
+ begin
29
+ tm = get_used_tm_sys_tm
30
+ rescue Exception => e
31
+ puts e.message
32
+ puts e.cause.message
33
+ puts e.cause.cause.message
34
+ end
35
+ tm.should be_a_kind_of RTM::TopicMap
36
+ tm.close
37
+ end
38
+ it "should let us create a topic map with topics" do
39
+ tm = get_used_tm_sys_tm
40
+ t = tm.get!("Hannes")
41
+ t.should be_a_kind_of RTM::Topic
42
+ t.should_not be_nil
43
+ t.reference.should == "http://www.topicmapslab.de/Hannes"
44
+ tm.close
45
+ tm = get_used_tm_sys.create("http://www.topicmapslab.de/")
46
+ t = tm.get("Hannes")
47
+ t.should be_a_kind_of RTM::Topic
48
+ t.should_not be_nil
49
+ t.reference.should == "http://www.topicmapslab.de/Hannes"
50
+ tm.remove
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,22 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ require File.dirname(__FILE__) + '/../spec_helper'
5
+
6
+ module RTM::TopicMap
7
+ describe self do
8
+ before(:each) do
9
+ @connection = get_used_tm_sys
10
+ @tm = @connection.create("http://www.example.org/toytm/")
11
+ end
12
+ describe "#associations" do
13
+ it "should give back a Set of Associations" do
14
+ if @tm.topics.empty?
15
+ @tm.from_xtm(File.dirname(__FILE__) + "/../../rtm/spec/resources/toyTM.xtm")
16
+ end
17
+ @tm.associations.should_not be_empty
18
+ end
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,49 @@
1
+ # Copyright: Copyright 2009 Topic Maps Lab, University of Leipzig.
2
+ # License: Apache License, Version 2.0
3
+
4
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../../rtm-majortom/lib")
5
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../../rtm-tmql/lib")
6
+
7
+ require 'spec'
8
+ require 'rtm/majortom'
9
+ require 'rtm/revision'
10
+
11
+ def implementation_for_spec
12
+ ENV['RTM_IMPLEMENTATION'] && ENV['RTM_IMPLEMENTATION'].to_sym || :ontopia # if env is nil, the "normal progress will go on" # TODO: remove ontopia, as it should be chosen by connect by default
13
+ end
14
+
15
+ def get_used_tm_sys
16
+ if implementation_for_spec == :majortom_db
17
+ begin
18
+ $database_params ||= YAML.load_file(File.join(File.dirname(__FILE__), "/../../rtm/spec/database_config.yml"))["database_params"]
19
+ rescue
20
+ raise("You need to define the database_config.yml in rtm/spec.")
21
+ end
22
+ connection = RTM.connect($database_params)
23
+ else
24
+ connection = RTM.connect(:implementation => :majortom)
25
+ end
26
+ return connection
27
+ end
28
+
29
+ def get_used_tm_sys_tm
30
+ engine = get_used_tm_sys
31
+ begin
32
+ tm = engine.create("http://www.topicmapslab.de/")
33
+ rescue Exception => e
34
+ print_stack_trace(e)
35
+ raise(e.message)
36
+ end
37
+ return tm
38
+ end
39
+
40
+ def print_stack_trace(e)
41
+ puts "\nError because of:"
42
+ puts e.message
43
+ while e.cause
44
+ puts "and because of:"
45
+ e = e.cause
46
+ puts e.message
47
+ puts e.printStackTrace
48
+ end
49
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rtm-majortom
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 3
8
+ - 1
9
+ version: 0.3.1
10
+ platform: java
11
+ authors:
12
+ - Sven Krosse
13
+ - Uta Schulze
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-09-28 00:00:00 +02:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rtm-javatmapi
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - "="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 3
31
+ - 1
32
+ version: 0.3.1
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ description: The MaJorToM backend for Ruby Topic Maps.
36
+ email: rtm+rtm-majortom-gem-20100928@topicmapslab.de
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - lib/rtm-majortom.rb
45
+ - lib/rtm/majortom.rb
46
+ - lib/rtm/revision.rb
47
+ - lib/rtm/majortom/core.rb
48
+ - lib/rtm/majortom/sugar.rb
49
+ - lib/rtm/majortom/core/topic.rb
50
+ - lib/rtm/majortom/sugar/topic_map.rb
51
+ - spec/spec_helper.rb
52
+ - spec/common/best_label_spec.rb
53
+ - spec/common/history_spec.rb
54
+ - spec/common/revision_index_spec.rb
55
+ - spec/common/revision_spec.rb
56
+ - spec/common/store_spec.rb
57
+ - spec/common/topic_map_spec.rb
58
+ - spec/common/topic_spec.rb
59
+ - spec/db/majortom_spec.rb
60
+ - spec/db/topic_map_spec.rb
61
+ - lib/rtm/majortom/javalibs/geotype-1.1.2-SNAPSHOT.jar
62
+ - lib/rtm/majortom/javalibs/majortom-core-1.1.2-SNAPSHOT.jar
63
+ - lib/rtm/majortom/javalibs/majortom-db-1.1.2-SNAPSHOT.jar
64
+ - lib/rtm/majortom/javalibs/majortom-inMemory-1.1.2-SNAPSHOT.jar
65
+ - lib/rtm/majortom/javalibs/majortom-model-1.1.2-SNAPSHOT.jar
66
+ - lib/rtm/majortom/javalibs/mysql-connector-java-5.1.13.jar
67
+ - lib/rtm/majortom/javalibs/postgresql-8.4-701.jdbc4.jar
68
+ - LICENSE
69
+ - DISCLAIMER
70
+ - README
71
+ has_rdoc: true
72
+ homepage: http://rtm.topicmapslab.de/
73
+ licenses: []
74
+
75
+ post_install_message:
76
+ rdoc_options: []
77
+
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ segments:
92
+ - 0
93
+ version: "0"
94
+ requirements: []
95
+
96
+ rubyforge_project: rtm
97
+ rubygems_version: 1.3.6
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: "Ruby Topic Maps: MaJorToM backend"
101
+ test_files: []
102
+