MINT-core 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +22 -3
- data/Gemfile.lock +98 -22
- data/History.txt +262 -0
- data/LICENSE +30 -0
- data/MINT-core.gemspec +25 -80
- data/Manifest.txt +145 -30
- data/README.rdoc +6 -163
- data/Rakefile +16 -17
- data/bin/mint-aui +3 -3
- data/bin/mint-cui-gfx +3 -2
- data/bin/mint-juggernaut.sh +0 -0
- data/bin/mint-tuplespace +0 -0
- data/lib/MINT-core.rb +53 -15
- data/lib/MINT-core/agent/agent.rb +1 -1
- data/lib/MINT-core/agent/aui.rb +0 -14
- data/lib/MINT-core/agent/auicontrol.rb +91 -38
- data/lib/MINT-core/agent/cui-gfx.rb +3 -3
- data/lib/MINT-core/agent/cuicontrol.rb +94 -24
- data/lib/MINT-core/connector/redis_connector.rb +16 -0
- data/lib/MINT-core/manager/mapping_manager.rb +101 -0
- data/lib/MINT-core/manager/mapping_parser.rb +89 -0
- data/lib/MINT-core/manager/mapping_server.rb +99 -0
- data/lib/MINT-core/manager/position_updater.rb +33 -0
- data/lib/MINT-core/manager/scxml_client.rb +118 -0
- data/lib/MINT-core/manager/scxml_server.rb +86 -0
- data/lib/MINT-core/mapping/action/action.rb +32 -0
- data/lib/MINT-core/mapping/action/backend_action.rb +32 -0
- data/lib/MINT-core/mapping/action/bind_action.rb +88 -0
- data/lib/MINT-core/mapping/action/event_action.rb +40 -0
- data/lib/MINT-core/mapping/complementary_mapping.rb +31 -0
- data/lib/MINT-core/mapping/mapping.rb +170 -34
- data/lib/MINT-core/mapping/observation/negation_observation.rb +64 -0
- data/lib/MINT-core/mapping/observation/observation.rb +219 -0
- data/lib/MINT-core/mapping/sequential.rb +1 -2
- data/lib/MINT-core/mapping/sequential_mapping.rb +60 -0
- data/lib/MINT-core/model/aui/AIChoiceElement.rb +17 -0
- data/lib/MINT-core/model/aui/AICommand.rb +7 -0
- data/lib/MINT-core/model/aui/AIContainer.rb +73 -0
- data/lib/MINT-core/model/aui/AIContext.rb +12 -0
- data/lib/MINT-core/model/aui/AIIN.rb +8 -0
- data/lib/MINT-core/model/aui/AIINContinuous.rb +56 -0
- data/lib/MINT-core/model/aui/AIINDiscrete.rb +8 -0
- data/lib/MINT-core/model/aui/AIMultiChoice.rb +1 -2
- data/lib/MINT-core/model/aui/AIMultiChoiceElement.rb +4 -51
- data/lib/MINT-core/model/aui/AIO.rb +76 -123
- data/lib/MINT-core/model/aui/AIOUT.rb +8 -0
- data/lib/MINT-core/model/aui/AIOUTContinuous.rb +61 -0
- data/lib/MINT-core/model/aui/AIReference.rb +16 -0
- data/lib/MINT-core/model/aui/AISingleChoice.rb +18 -1
- data/lib/MINT-core/model/aui/AISingleChoiceElement.rb +10 -56
- data/lib/MINT-core/model/aui/AISinglePresence.rb +39 -71
- data/lib/MINT-core/model/aui/aicommand.scxml +47 -0
- data/lib/MINT-core/model/aui/aicontainer.scxml +41 -0
- data/lib/MINT-core/model/aui/aicontext.scxml +34 -0
- data/lib/MINT-core/model/aui/aiincontinuous.scxml +59 -0
- data/lib/MINT-core/model/aui/aiinrange.scxml +86 -0
- data/lib/MINT-core/model/aui/aimultichoice.scxml +67 -0
- data/lib/MINT-core/model/aui/aimultichoiceelement.scxml +51 -0
- data/lib/MINT-core/model/aui/aio.scxml +18 -27
- data/lib/MINT-core/model/aui/aioutcontinuous.scxml +66 -0
- data/lib/MINT-core/model/aui/aireference.scxml +28 -0
- data/lib/MINT-core/model/aui/aisinglechoice.scxml +60 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.scxml +45 -60
- data/lib/MINT-core/model/aui/aisinglepresence.scxml +15 -24
- data/lib/MINT-core/model/aui/model.rb +15 -38
- data/lib/MINT-core/model/cui/gfx/CIC.rb +34 -10
- data/lib/MINT-core/model/cui/gfx/CIO.rb +66 -115
- data/lib/MINT-core/model/cui/gfx/CarouFredSel.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/MarkableRadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButton.rb +8 -0
- data/lib/MINT-core/model/cui/gfx/RadioButtonGroup.rb +6 -0
- data/lib/MINT-core/model/cui/gfx/button.rb +16 -0
- data/lib/MINT-core/model/cui/gfx/button.scxml +58 -0
- data/lib/MINT-core/model/cui/gfx/caroufredsel.rb +48 -0
- data/lib/MINT-core/model/cui/gfx/cic.scxml +57 -0
- data/lib/MINT-core/model/cui/gfx/cio.scxml +54 -0
- data/lib/MINT-core/model/cui/gfx/markableradiobutton.scxml +67 -0
- data/lib/MINT-core/model/cui/gfx/model.rb +39 -176
- data/lib/MINT-core/model/cui/gfx/radiobutton.scxml +59 -0
- data/lib/MINT-core/model/interactor.rb +167 -46
- data/lib/MINT-core/model/interactor.scxml +3 -0
- data/lib/MINT-core/model/interactor_helpers.rb +25 -0
- data/lib/MINT-core/model/ir/body/OneHandPoseNavigation.rb +15 -0
- data/lib/MINT-core/model/ir/body/body.rb +5 -0
- data/lib/MINT-core/model/ir/body/fingertip.rb +114 -0
- data/lib/MINT-core/model/ir/body/fingertip.scxml +43 -0
- data/lib/MINT-core/model/{body → ir/body}/gesture_button.rb +0 -0
- data/lib/MINT-core/model/ir/body/hand.rb +5 -0
- data/lib/MINT-core/model/ir/body/head.rb +102 -0
- data/lib/MINT-core/model/ir/body/head.scxml +92 -0
- data/lib/MINT-core/model/ir/body/onehandposenavigation.scxml +53 -0
- data/lib/MINT-core/model/ir/body/pose.rb +99 -0
- data/lib/MINT-core/model/ir/browserscreen.rb +27 -0
- data/lib/MINT-core/model/ir/browserscreen.scxml +14 -0
- data/lib/MINT-core/model/{device → ir}/button.rb +1 -1
- data/lib/MINT-core/model/ir/ir.rb +5 -0
- data/lib/MINT-core/model/ir/irmedia.rb +5 -0
- data/lib/MINT-core/model/ir/irmode.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/joypad.rb +1 -1
- data/lib/MINT-core/model/ir/mouse.rb +44 -0
- data/lib/MINT-core/model/ir/mouse.scxml +35 -0
- data/lib/MINT-core/model/{device/mouse.rb → ir/mouse_old.rb} +2 -2
- data/lib/MINT-core/model/{device → ir}/pointer.rb +20 -22
- data/lib/MINT-core/model/ir/pointer.scxml +19 -0
- data/lib/MINT-core/model/ir/screen.rb +5 -0
- data/lib/MINT-core/model/{device → ir}/wheel.rb +1 -1
- data/lib/MINT-core/model/mim/aicommand_activate_to_button_press.xml +13 -0
- data/lib/MINT-core/model/mim/aicommand_deactivate_to_button_release.xml +13 -0
- data/lib/MINT-core/model/mim/aio_defocus_to_cio_unhighlight.xml +13 -0
- data/lib/MINT-core/model/mim/aio_focus_to_cio_highlight.xml +14 -0
- data/lib/MINT-core/model/mim/aio_present_to_cio_display.xml +14 -0
- data/lib/MINT-core/model/mim/aio_suspend_to_cio_hide.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoice_present_to_child_present.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_chosen_to_radiobutton_select.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglechoiceelement_unchosen_to_radiobutton_unselect.xml +13 -0
- data/lib/MINT-core/model/mim/aisinglepresence_children_finished_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/aisinglepresence_present_to_child_present.xml +15 -0
- data/lib/MINT-core/model/mim/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/lib/MINT-core/model/mim/button_press_to_aicommand_activate.xml +12 -0
- data/lib/MINT-core/model/mim/button_release_to_aicommand_deactivate.xml +12 -0
- data/lib/MINT-core/model/mim/caroufredsel_refreshing_to_caroufredsel_init_js.xml +14 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_defocus.xml +13 -0
- data/lib/MINT-core/model/mim/cio_display_to_aio_present.xml +12 -0
- data/lib/MINT-core/model/mim/cio_display_to_cio_display_cache_add.xml +11 -0
- data/lib/MINT-core/model/mim/cio_hide_to_aio_suspend.xml +12 -0
- data/lib/MINT-core/model/mim/cio_hide_to_cio_display_cache_remove.xml +12 -0
- data/lib/MINT-core/model/mim/cio_highlight_to_aio_focus.xml +13 -0
- data/lib/MINT-core/model/mim/head_looking_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_looking_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_nodding_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/head_tilting_left_to_aisinglepresence_prev.xml +14 -0
- data/lib/MINT-core/model/mim/head_tilting_right_to_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_enter.xml +15 -0
- data/lib/MINT-core/model/mim/left_button_aisinglepresence_next.xml +15 -0
- data/lib/MINT-core/model/mim/mim_default.xml +52 -0
- data/lib/MINT-core/model/mim/mint-mappings.xsd +127 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aicommand_activate.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_choose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_press_to_aisinglechoiceelement_unchoose.xml +17 -0
- data/lib/MINT-core/model/mim/mouse_release_to_aicommand_deactivate.xml +16 -0
- data/lib/MINT-core/model/mim/mouse_stop_to_cio_highlight.xml +13 -0
- data/lib/MINT-core/model/mim/onehandposnav_confirm_to_aichoiceelement_choose.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_next_to_aio_next.xml +14 -0
- data/lib/MINT-core/model/mim/onehandposnav_previous_to_aio_prev.xml +14 -0
- data/lib/MINT-core/model/mim/radiobutton_selected_to_aisinglechoiceelement_choose.xml +13 -0
- data/lib/MINT-core/model/mim/radiobutton_unselected_to_aisinglechoiceelement_unchoose.xml +13 -0
- data/lib/MINT-core/model/mim/right_button_aisinglepresence_prev.xml +15 -0
- data/lib/MINT-core/model/task.rb +6 -6
- data/script/console +0 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/spec/AICommand_spec.rb +20 -0
- data/spec/AIContainer_spec.rb +161 -0
- data/spec/AIINContinuous_spec.rb +92 -0
- data/spec/AIOUTContinuous_spec.rb +93 -0
- data/spec/AIO_spec.rb +73 -0
- data/spec/AIReference_spec.rb +105 -0
- data/spec/AISinglePresence_spec.rb +204 -60
- data/spec/Button_spec.rb +114 -0
- data/spec/CIO_spec.rb +145 -0
- data/spec/Interactor_spec.rb +95 -0
- data/spec/MappingManager_spec.rb +126 -0
- data/spec/Spontaneous_spec.rb +53 -0
- data/spec/aio_agent_spec.rb +215 -186
- data/spec/aisinglechoice_spec.rb +147 -88
- data/spec/aisinglechoiceelement_spec.rb +154 -70
- data/spec/complementary_mapping_spec.rb +158 -0
- data/spec/core_spec.rb +27 -15
- data/spec/cui_helper.rb +100 -0
- data/spec/examples/browserscreen_reload_to_cuicontrol_refresh_all.xml +12 -0
- data/spec/examples/mim_streaming_example.xml +9 -0
- data/spec/examples/mouse_highlight.xml +22 -0
- data/spec/examples/performance_mapping.xml +15 -0
- data/spec/examples/reset_click.xml +24 -0
- data/spec/interactor_test.scxml +32 -0
- data/spec/interactor_test_2.scxml +16 -0
- data/spec/mapping_performance_spec.rb +118 -0
- data/spec/mapping_server_spec.rb +161 -0
- data/spec/mapping_spec.rb +307 -0
- data/spec/music_spec.rb +301 -135
- data/spec/performance_counter.scxml +9 -0
- data/spec/sequential_mappings_spec.rb +69 -0
- data/spec/shared/aio_shared.rb +144 -0
- data/spec/spec_helper.rb +22 -3
- data/spec/spontaneous.scxml +11 -0
- data/spec/support/connection_helper.rb +19 -0
- data/spec/support/redis_connector_monkey_patch.rb +1 -0
- data/spec/support/statemachine_helper.rb +84 -0
- data/spec/sync_mappings_spec.rb +96 -0
- metadata +219 -354
- data/lib/MINT-core/mapping/complementary.rb +0 -100
- data/lib/MINT-core/mapping/on_state_change.rb +0 -65
- data/lib/MINT-core/model/aui/AIC.rb +0 -86
- data/lib/MINT-core/model/aui/AIChoice.rb +0 -65
- data/lib/MINT-core/model/aui/AIINChoose.rb +0 -54
- data/lib/MINT-core/model/aui/AIOUTDiscrete.rb +0 -43
- data/lib/MINT-core/model/aui/aic.png +0 -0
- data/lib/MINT-core/model/aui/aic.scxml +0 -50
- data/lib/MINT-core/model/aui/aichoice.png +0 -0
- data/lib/MINT-core/model/aui/aichoice.scxml +0 -60
- data/lib/MINT-core/model/aui/aio.png +0 -0
- data/lib/MINT-core/model/aui/aisinglechoiceelement.png +0 -0
- data/lib/MINT-core/model/aui/aisinglepresence.png +0 -0
- data/lib/MINT-core/model/body/handgesture.rb +0 -279
- data/lib/MINT-core/model/body/head.png +0 -0
- data/lib/MINT-core/model/body/head.rb +0 -51
- data/lib/MINT-core/model/body/head.scxml +0 -28
- data/lib/MINT-core/model/cui/gfx/screen.rb +0 -18
- data/lib/MINT-core/overrides/rinda.rb +0 -34
- data/spec/AIC_spec.rb +0 -69
- data/spec/MINT-core_spec.rb +0 -11
- data/spec/aio_spec.rb +0 -144
- data/spec/cio_spec.rb +0 -369
- data/tasks/rspec.rake +0 -21
@@ -0,0 +1,53 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
require "em-spec/rspec"
|
4
|
+
|
5
|
+
|
6
|
+
describe 'Spontaneous' do
|
7
|
+
include EventMachine::SpecHelper
|
8
|
+
|
9
|
+
before :all do
|
10
|
+
|
11
|
+
connection_options = { :adapter => "redis"}
|
12
|
+
DataMapper.setup(:default, connection_options)
|
13
|
+
|
14
|
+
connect do |redis|
|
15
|
+
require "MINT-core"
|
16
|
+
require "support/redis_connector_monkey_patch" # TODO dirty patch for a bug that i have not found :(
|
17
|
+
|
18
|
+
class Spontaneous < MINT::Interactor
|
19
|
+
def getSCXML
|
20
|
+
"#{File.dirname(__FILE__)}/spontaneous.scxml"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
DataMapper.finalize
|
25
|
+
DataMapper::Model.raise_on_save_failure = true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'synchronized with RedisDB' do
|
30
|
+
|
31
|
+
it 'should do the spontaneous transition to positioned' do
|
32
|
+
connect do |redis|
|
33
|
+
@a = Spontaneous.create(:name => "test")
|
34
|
+
@a.process_event(:position)
|
35
|
+
@a.new_states.should == [:positioned, :superstate]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
describe 'synchronized with Redis-PubSub' do
|
40
|
+
it 'should do the spontaneous transition to positioned and publish passing of positioning state ' do
|
41
|
+
connect true do |redis|
|
42
|
+
|
43
|
+
test_state_flow redis,"Interactor.Spontaneous.test" ,["initialized",["superstate", "positioning"],"positioned"] do
|
44
|
+
|
45
|
+
@a = Spontaneous.create(:name => "test")
|
46
|
+
@a.process_event(:position)
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/spec/aio_agent_spec.rb
CHANGED
@@ -1,234 +1,263 @@
|
|
1
|
-
require "spec"
|
2
1
|
require "spec_helper"
|
2
|
+
require "em-spec/rspec"
|
3
|
+
|
4
|
+
def create_scenario
|
5
|
+
include MINT
|
6
|
+
|
7
|
+
@aui = MINT::AIContainer.create(:name=>"RecipeFinder",
|
8
|
+
:children => "RecipeFinder_label|RecipeFinder_description|RecipeFilter|RecipeSelection")
|
9
|
+
MINT::AIReference.create(:name=>"RecipeFinder_label",:parent =>"RecipeFinder",:text=>"Willkommen")
|
10
|
+
MINT::AIContext.create(:name=>"RecipeFinder_description",:parent =>"RecipeFinder",:text=>"Willkommen beim 4 Sterne Koch Assistenten.")
|
11
|
+
MINT::AIContainer.create(:name=>"RecipeFilter",:parent =>"RecipeFinder",
|
12
|
+
:children => "RecipeFilter_label|RecipeFilter_description|RecipeCuisine|RecipeCategory|RecipeCalories")
|
13
|
+
MINT::AIReference.create(:name=>"RecipeFilter_label",:parent =>"RecipeFilter",:text=>"Suchkriterien")
|
14
|
+
MINT::AIContext.create(:name=>"RecipeFilter_description",:parent =>"RecipeFilter",:text=>"In diesem Feld koennen Sie mit genauen Angaben zu Ihrem Gericht-Wunsch die Suche nach Ihrem Rezeptvorschlag eingrenzen.")
|
15
|
+
MINT::AIContainer.create(:name=>"RecipeCuisine",:parent =>"RecipeFilter",
|
16
|
+
:children => "RecipeCuisine_label|RecipeCuisine_description|RecipeCuisine_choice")
|
17
|
+
MINT::AIReference.create(:name=>"RecipeCuisine_label",:parent =>"RecipeCuisine",:text=>"Nationale Kueche")
|
18
|
+
MINT::AIContext.create(:name=>"RecipeCuisine_description",:parent =>"RecipeCuisine",:text=>"Welche nationale Kueche waehlen Sie? ")
|
19
|
+
MINT::AIMultiChoice.create(:name=>"RecipeCuisine_choice",:parent =>"RecipeCuisine",
|
20
|
+
:children => "French|German|Italian|Chinese")
|
21
|
+
MINT::AIChoiceElement.create(:name => "French", :parent =>"RecipeCuisine_choice",:text =>"Franzoesisch")
|
22
|
+
MINT::AIChoiceElement.create(:name => "German",:parent =>"RecipeCuisine_choice",:text =>"Deutsch")
|
23
|
+
MINT::AIChoiceElement.create(:name => "Italian",:parent =>"RecipeCuisine_choice",:text =>"Italienisch")
|
24
|
+
MINT::AIChoiceElement.create(:name => "Chinese",:parent =>"RecipeCuisine_choice",:text =>"Chinesisch")
|
25
|
+
|
26
|
+
MINT::AIContainer.create(:name=>"RecipeCategory",:parent =>"RecipeFilter",
|
27
|
+
:children => "RecipeCategory_label|RecipeCategory_description|RecipeCategory_choice")
|
28
|
+
MINT::AIReference.create(:name=>"RecipeCategory_label",:parent =>"RecipeCategory",:text=>"Menueart ")
|
29
|
+
MINT::AIContext.create(:name=>"RecipeCategory_description",:parent =>"RecipeCategory",:text=>" Welche Menueart moechten Sie kochen? ")
|
30
|
+
MINT::AIMultiChoice.create(:name=>"RecipeCategory_choice",:parent =>"RecipeCategory",
|
31
|
+
:children => "Main|Pastry|Dessert|Starter")
|
32
|
+
MINT::AIChoiceElement.create(:name => "Main", :parent =>"RecipeCategory_choice",:text =>"Hauptgericht")
|
33
|
+
MINT::AIChoiceElement.create(:name => "Pastry",:parent =>"RecipeCategory_choice",:text =>"Gebaeck")
|
34
|
+
MINT::AIChoiceElement.create(:name => "Dessert",:parent =>"RecipeCategory_choice",:text =>"Nachtisch")
|
35
|
+
MINT::AIChoiceElement.create(:name => "Starter",:parent =>"RecipeCategory_choice",:text =>"Vorspeise")
|
36
|
+
|
37
|
+
MINT::AIContainer.create(:name=>"RecipeCalories",:parent =>"RecipeFilter",
|
38
|
+
:children => "RecipeCalories_label|RecipeCalories_description|RecipeCalories_choice")
|
39
|
+
MINT::AIReference.create(:name=>"RecipeCalories_label",:parent =>"RecipeCalories",:text=>"gesundheitsbewusst ")
|
40
|
+
MINT::AIContext.create(:name=>"RecipeCalories_description",:parent =>"RecipeCalories",:text=>" Wollen Sie gesundheitsbewusst kochen? ")
|
41
|
+
MINT::AISingleChoice.create(:name=>"RecipeCalories_choice",:parent =>"RecipeCalories",
|
42
|
+
:children => "Diet|LowFat|NotRelevant")
|
43
|
+
MINT::AIChoiceElement.create(:name => "Diet", :text =>"Hauptgericht",:parent =>"RecipeCalories_choice")
|
44
|
+
MINT::AIChoiceElement.create(:name => "LowFat",:text =>"Gebaeck",:parent =>"RecipeCalories_choice")
|
45
|
+
MINT::AIChoiceElement.create(:name => "NotRelevant",:text =>"Nachtisch",:parent =>"RecipeCalories_choice")
|
46
|
+
|
47
|
+
|
48
|
+
MINT::AIContainer.create(:name =>"RecipeSelection",:parent =>"RecipeFinder",
|
49
|
+
:children => "RecipeSelection_label|RecipeSelection_description|FoundRecipes|Start")
|
50
|
+
MINT::AIReference.create(:name=>"RecipeSelection_label",:text=>"Rezeptdetails",:parent =>"RecipeSelection")
|
51
|
+
MINT::AIContext.create(:name=>"RecipeSelection_description",:parent =>"RecipeSelection",:text=>"Hier werden Ihre Rezeptvorschlaege mit den Details angezeigt und Sie koennen bestimmen, fuer wieviele Personen das Rezept berechnet werden soll.")
|
52
|
+
MINT::AISingleChoice.create(:name=>"FoundRecipes",:parent =>"RecipeSelection",
|
53
|
+
:children => "Schweinebraten|Lammkotletts|Spagetti")
|
54
|
+
MINT::AIChoiceElement.create(:name => "Schweinebraten", :text =>"Schweinebraten",:parent =>"FoundRecipes")
|
55
|
+
MINT::AIChoiceElement.create(:name => "Lammkotletts",:text =>"Lammkotletts",:parent =>"FoundRecipes")
|
56
|
+
MINT::AIChoiceElement.create(:name => "Spagetti",:text =>"Spagetti",:parent =>"FoundRecipes")
|
57
|
+
MINT::AICommand.create(:name=>"Start",:text=>"Kochassistent starten",:parent =>"RecipeSelection")
|
58
|
+
|
59
|
+
end
|
3
60
|
|
4
61
|
describe 'AUI-Agent' do
|
5
|
-
before :each do
|
6
|
-
connection_options = { :adapter => "in_memory"}
|
7
|
-
DataMapper.setup(:default, connection_options)
|
8
|
-
# DataMapper.setup(:default, { :adapter => "rinda", :host =>"localhost",:port=>4000})
|
9
|
-
# ,:local =>Rinda::TupleSpace.new})
|
10
|
-
# DataMapper::Logger.new("data.log", :debug)
|
11
|
-
@aui = AIC.new(:name=>"RecipeFinder",
|
12
|
-
:childs =>[
|
13
|
-
AIINReference.new(:name=>"RecipeFinder_label",:label=>"Willkommen"),
|
14
|
-
AIOUTContext.new(:name=>"RecipeFinder_description",:text=>"Willkommen beim 4 Sterne Koch Assistenten."),
|
15
|
-
AIC.new(:name=>"RecipeFilter",
|
16
|
-
:childs => [
|
17
|
-
AIINReference.new(:name=>"RecipeFilter_label",:label=>"Suchkriterien"),
|
18
|
-
AIOUTContext.new(:name=>"RecipeFilter_description",:text=>"In diesem Feld können Sie mit genauen Angaben zu Ihrem Gericht-Wunsch die Suche nach Ihrem Rezeptvorschlag eingrenzen."),
|
19
|
-
AIC.new(:name=>"RecipeCuisine",
|
20
|
-
:childs=>[
|
21
|
-
AIINReference.new(:name=>"RecipeCuisine_label",:label=>"Nationale Küche"),
|
22
|
-
AIOUTContext.new(:name=>"RecipeCuisine_description",:text=>"Welche nationale Küche wählen Sie? "),
|
23
|
-
AIMultiChoice.new(:name=>"RecipeCuisine_choice",
|
24
|
-
:childs =>[
|
25
|
-
AIINChoose.new(:name => "French", :label =>"Französisch"),
|
26
|
-
AIINChoose.new(:name => "German",:label =>"Deutsch"),
|
27
|
-
AIINChoose.new(:name => "Italian",:label =>"Italienisch"),
|
28
|
-
AIINChoose.new(:name => "Chinese",:label =>"Chinesisch")
|
29
|
-
]
|
30
|
-
)
|
31
|
-
]),
|
32
|
-
AIC.new(:name=>"RecipeCategory",
|
33
|
-
:childs=>[
|
34
|
-
AIINReference.new(:name=>"RecipeCategory_label",:label=>"Menǘart "),
|
35
|
-
AIOUTContext.new(:name=>"RecipeCategory_description",:text=>" Welche Menǘart möchten Sie kochen? "),
|
36
|
-
AIMultiChoice.new(:name=>"RecipeCategory_choice",
|
37
|
-
:childs =>[
|
38
|
-
AIINChoose.new(:name => "Main", :label =>"Hauptgericht"),
|
39
|
-
AIINChoose.new(:name => "Pastry",:label =>"Gebäck"),
|
40
|
-
AIINChoose.new(:name => "Dessert",:label =>"Nachtisch"),
|
41
|
-
AIINChoose.new(:name => "Starter",:label =>"Vorspeise")
|
42
|
-
]
|
43
|
-
)
|
44
|
-
]),
|
45
|
-
AIC.new(:name=>"RecipeCalories",
|
46
|
-
:childs=>[
|
47
|
-
AIINReference.new(:name=>"RecipeCalories_label",:label=>"gesundheitsbewusst "),
|
48
|
-
AIOUTContext.new(:name=>"RecipeCalories_description",:text=>" Wollen Sie gesundheitsbewusst kochen? "),
|
49
|
-
AISingleChoice.new(:name=>"RecipeCalories_choice",
|
50
|
-
:childs =>[
|
51
|
-
AIINChoose.new(:name => "Diet", :label =>"Hauptgericht"),
|
52
|
-
AIINChoose.new(:name => "Low fat",:label =>"Gebäck"),
|
53
|
-
AIINChoose.new(:name => "Not Relevant",:label =>"Nachtisch"),
|
54
|
-
]
|
55
|
-
)
|
56
|
-
]),
|
57
|
-
]),
|
58
|
-
AIC.new(:name =>"RecipeSelection",
|
59
|
-
:childs => [
|
60
|
-
AIINReference.new(:name=>"RecipeSelection_label",:label=>"Rezeptdetails"),
|
61
|
-
AIOUTContext.new(:name=>"RecipeSelection_description",:text=>"Hier werden Ihre Rezeptvorschläge mit den Details angezeigt und Sie können bestimmen, für wieviele Personen das Rezept berechnet werden soll."),
|
62
|
-
AISingleChoice.new(:name=>"FoundRecipes",
|
63
|
-
:childs =>[
|
64
|
-
AIINChoose.new(:name => "Schweinebraten", :label =>"Schweinebraten"),
|
65
|
-
AIINChoose.new(:name => "Lamkotletts",:label =>"Lammkotletts"),
|
66
|
-
AIINChoose.new(:name => "Spagetti",:label =>"Spagetti"),
|
67
|
-
]
|
68
|
-
),
|
69
|
-
AICommand.new(:name=>"Start",:label=>"Kochassistent starten",:description=>"Hier können Sie den Kochassistenten starten.")
|
70
|
-
])
|
71
|
-
])
|
72
|
-
@aui.save!
|
73
62
|
|
63
|
+
include EventMachine::SpecHelper
|
64
|
+
|
65
|
+
before :all do
|
66
|
+
connection_options = { :adapter => "redis"}
|
67
|
+
DataMapper.setup(:default, connection_options)
|
68
|
+
|
69
|
+
connect do |redis|
|
70
|
+
require "MINT-core"
|
71
|
+
|
72
|
+
DataMapper.finalize
|
73
|
+
DataMapper::Model.raise_on_save_failure = true
|
74
|
+
end
|
74
75
|
end
|
75
|
-
|
76
|
+
|
76
77
|
describe 'organizing' do
|
77
|
-
|
78
|
+
|
78
79
|
it 'should save correctly' do
|
79
|
-
|
80
|
-
|
80
|
+
pending "no longer needed "
|
81
|
+
class P < MINT::Interactor
|
82
|
+
|
81
83
|
# belongs_to :c
|
82
84
|
belongs_to :parent, 'C',
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
85
|
+
:parent_key => [ :id ], # in the remote model (Blog)
|
86
|
+
:child_key => [ :c_id ], # local to this model (Post)
|
87
|
+
:required => true
|
88
|
+
|
87
89
|
has 1, :next, P
|
88
90
|
has 1, :previous, P
|
89
91
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
|
93
|
+
class C < P
|
94
|
+
has n, :children, 'P',
|
95
|
+
:parent_key => [ :id ], # local to this model (Blog)
|
96
|
+
:child_key => [ :c_id ] # in the remote model (Post)
|
97
|
+
|
98
|
+
end
|
99
|
+
|
98
100
|
t2 = P.new(:name=>"Test2")
|
99
|
-
t1 = C.new(:name=>"Test1", :childs =>[t2],:next=>t2)
|
101
|
+
t1 = C.new(:name=>"Test1", :childs =>[t2],:next=>t2)
|
100
102
|
t2.previous = t1
|
101
|
-
|
103
|
+
|
102
104
|
t1.childs[0].parent.name.should =="Test1"
|
103
|
-
|
105
|
+
|
104
106
|
t1.save!
|
105
|
-
|
106
|
-
|
107
|
+
|
108
|
+
|
107
109
|
P.first(:name=>"Test2").parent.name.should == "Test1"
|
108
110
|
P.first(:name=>"Test2").previous.name.should == "Test1"
|
109
111
|
C.first(:name=>"Test1").next.name.should == "Test2"
|
110
112
|
end
|
111
|
-
|
113
|
+
|
112
114
|
it "should organize parental relations correctly" do
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
115
|
+
connect do |redis|
|
116
|
+
aic = MINT::AIContainer.create(:name =>"AIContainer", :children => "AIO")
|
117
|
+
MINT::AIO.create(:name=>"AIO",:parent =>"AIContainer")
|
118
|
+
aic.save!
|
119
|
+
|
120
|
+
MINT::AIO.first(:name=>"AIO").parent.name.should == "AIContainer"
|
121
|
+
end
|
117
122
|
end
|
118
|
-
|
123
|
+
|
119
124
|
it "should organize parental relations correctly 2" do
|
120
|
-
|
121
|
-
:
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
+
connect do |redis|
|
126
|
+
MINT::AIContainer.create(:name=>"RecipeFinder",
|
127
|
+
:children => "RecipeFinder_label")
|
128
|
+
MINT::AIReference.create(:name=>"RecipeFinder_label",:parent =>"RecipeFinder",:text=>"Willkommen")
|
129
|
+
|
130
|
+
MINT::AIO.first(:name=>"RecipeFinder_label").parent.name.should == "RecipeFinder"
|
131
|
+
end
|
125
132
|
end
|
126
|
-
|
133
|
+
|
127
134
|
it "should organize parental relations correctly 3" do
|
128
|
-
|
135
|
+
connect do |redis|
|
136
|
+
create_scenario
|
137
|
+
MINT::AIO.first(:name=>"RecipeFinder_label").parent.name.should == "RecipeFinder"
|
129
138
|
end
|
130
|
-
|
139
|
+
end
|
140
|
+
|
131
141
|
it 'should organize with parental relationships 4' do
|
132
|
-
|
142
|
+
connect do |redis|
|
143
|
+
create_scenario
|
144
|
+
MINT::AIChoiceElement.first(:name => "Main").parent.name.should == "RecipeCategory_choice"
|
145
|
+
end
|
133
146
|
end
|
134
|
-
|
147
|
+
|
135
148
|
it 'should support next navigation' do
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
connect do |redis|
|
150
|
+
create_scenario
|
151
|
+
AUIControl.organize(@aui)
|
152
|
+
@aui.save!#.should==true
|
153
|
+
@aui.next.name.should=="RecipeFinder_description" # a label does forward the navigation
|
154
|
+
@aui.next.next.next.next.name.should=="RecipeCuisine"
|
155
|
+
|
156
|
+
|
157
|
+
n = MINT::AIO.first(:name => "RecipeFinder")
|
158
|
+
10.times {n=n.next}
|
159
|
+
n.name.should=="Chinese"
|
160
|
+
12.times {n=n.next}
|
161
|
+
n.name.should=="LowFat"
|
162
|
+
8.times {n=n.next}
|
163
|
+
n.name.should=="Start"
|
164
|
+
end end
|
165
|
+
|
152
166
|
it "should support previous navigation" do
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
end
|
167
|
+
connect do |redis|
|
168
|
+
create_scenario
|
169
|
+
AUIControl.organize(@aui)
|
170
|
+
@aui.save!
|
171
|
+
|
172
|
+
n = MINT::AIO.first(:name => "Start")
|
173
|
+
# n = @aui #
|
174
|
+
# 36.times {n=n.next}
|
175
|
+
#n.name.should=="Start"
|
176
|
+
|
177
|
+
10.times {n=n.previous}
|
178
|
+
n.name.should=="RecipeCalories_choice"
|
179
|
+
4.times {n=n.previous}
|
180
|
+
n.name.should=="Dessert"
|
181
|
+
16.times {n=n.previous}
|
182
|
+
n.name.should=="RecipeFinder"
|
183
|
+
end end
|
171
184
|
|
172
|
-
it 'should support next navigation in organize 2' do
|
173
|
-
pending
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
185
|
+
it 'should support next navigation in organize 2' do
|
186
|
+
pending "currently only one mode is supported"
|
187
|
+
connect do |redis|
|
188
|
+
create_scenario
|
189
|
+
AUIControl.organize2(@aui)
|
190
|
+
# @aui.save#.should==true
|
191
|
+
# @aui.next.name.should=="RecipeFinder"
|
192
|
+
# @aui.next.next.next.next.name.should=="RecipeFinder"
|
178
193
|
|
179
|
-
|
180
|
-
n = AIO.first(:name => "RecipeFinder_label")
|
181
|
-
3.times {n=n.next}
|
182
|
-
n.name.should=="RecipeSelection"
|
183
194
|
|
184
|
-
|
185
|
-
|
186
|
-
|
195
|
+
n = MINT::AIO.first(:name => "RecipeFinder_label")
|
196
|
+
3.times {n=n.next}
|
197
|
+
n.name.should=="RecipeSelection"
|
198
|
+
|
199
|
+
n = MINT::AIO.first(:name => "RecipeCalories_label")
|
200
|
+
2.times {n=n.next}
|
201
|
+
n.name.should=="RecipeCalories_choice"
|
187
202
|
|
188
203
|
# n = AIO.first(:name => "Start")
|
189
204
|
# 7.times {n=n.next}
|
190
205
|
# n.name.should=="FoundRecipes"
|
191
|
-
|
192
|
-
|
206
|
+
end end
|
207
|
+
|
193
208
|
it "should support previous navigation in organize 2" do
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
209
|
+
pending "currently only one mode is supported"
|
210
|
+
|
211
|
+
connect do |redis|
|
212
|
+
create_scenario
|
213
|
+
AUIControl.organize2(@aui)
|
214
|
+
|
215
|
+
@aui.save # there is still a bug, because save results in false!!
|
216
|
+
#.should==true
|
217
|
+
|
218
|
+
n = MINT::AIO.first(:name => "Start")
|
219
|
+
# n = @aui #
|
220
|
+
# 36.times {n=n.next}
|
221
|
+
#n.name.should=="Start"
|
222
|
+
|
223
|
+
3.times {n=n.previous}
|
224
|
+
n.name.should=="RecipeSelection_label"
|
225
|
+
|
226
|
+
n = MINT::AIO.first(:name => "RecipeCalories")
|
227
|
+
2.times {n=n.previous}
|
228
|
+
n.name.should=="RecipeCuisine"
|
211
229
|
|
212
230
|
# n = AIO.first(:name => "RecipeFinder")
|
213
231
|
# 3.times {n=n.previous}
|
214
|
-
|
232
|
+
# n.name.should=="RecipeFinder"
|
233
|
+
end
|
215
234
|
end
|
216
|
-
|
235
|
+
|
217
236
|
it "should find the correct common aic for only one task in ETS" do
|
218
|
-
|
237
|
+
connect do |redis|
|
238
|
+
create_scenario
|
239
|
+
AUIControl.find_common(["Start"]).should=="Start"
|
240
|
+
end
|
219
241
|
end
|
220
|
-
|
242
|
+
|
221
243
|
it "should find the correct common aic for a given ETS" do
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
244
|
+
connect do |redis|
|
245
|
+
create_scenario
|
246
|
+
AUIControl.find_common(["RecipeCuisine","RecipeCategory"]).should=="RecipeFilter"
|
247
|
+
AUIControl.find_common(["Schweinebraten","RecipeSelection_description"]).should=="RecipeSelection"
|
248
|
+
AUIControl.find_common(["Italian","Starter"]).should=="RecipeFilter"
|
249
|
+
AUIControl.find_common(["RecipeFinder_label","RecipeFinder_description"]).should=="RecipeFinder"
|
250
|
+
AUIControl.find_common(["Schweinebraten","RecipeCalories_choice","RecipeFinder_description"]).should=="RecipeFinder"
|
251
|
+
end
|
227
252
|
end
|
228
|
-
|
229
|
-
it "should find the correct common
|
230
|
-
|
231
|
-
|
253
|
+
|
254
|
+
it "should find the correct common AIContainer for a given ETS 2" do
|
255
|
+
connect do |redis|
|
256
|
+
create_scenario
|
257
|
+
AUIControl.find_common(["RecipeCategory","Start", "FoundRecipes"]).should=="RecipeFinder"
|
258
|
+
|
259
|
+
AUIControl.find_common(["RecipeCategory", "Start", "FoundRecipes", "RecipeCuisine", "RecipeCalories"]).should=="RecipeFinder"
|
260
|
+
end
|
232
261
|
end
|
233
262
|
end
|
234
|
-
end
|
263
|
+
end
|