Class: JIJI::Service::ProcessService

Inherits:
Object
  • Object
show all
Defined in:
lib/jiji/service/process_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#process_managerObject

Returns the value of attribute process_manager.



58
59
60
# File 'lib/jiji/service/process_service.rb', line 58

def process_manager
  @process_manager
end

Instance Method Details

#delete_test(process_id) ⇒ Object

テストを削除する



43
44
45
# File 'lib/jiji/service/process_service.rb', line 43

def delete_test( process_id )
  @process_manager.delete_back_test( process_id )
end

#get(process_id) ⇒ Object

プロセスを取得する。



15
16
17
18
19
20
# File 'lib/jiji/service/process_service.rb', line 15

def get( process_id )
  p = @process_manager.get( process_id )
  process_info = extract_properties( p )
  process_info["agents"] = p["agents"] # getの場合はエージェントのプロパティも返す。
  return process_info
end

#list_testObject

プロセス一覧を取得する。



6
7
8
9
10
11
12
# File 'lib/jiji/service/process_service.rb', line 6

def list_test( )
  buff = []
  @process_manager.each {|p|
    buff << extract_properties( p )
  }
  return buff.sort_by {|item| item["create_date"] * -1 }
end

#new_test(name, memo, start_date, end_date, agents) ⇒ Object

新しいテストを作成&開始する



29
30
31
32
# File 'lib/jiji/service/process_service.rb', line 29

def new_test( name, memo, start_date, end_date, agents )
  @process_manager.create_back_test(
    name, memo, start_date, end_date, agents );
end

#restart(process_id, agent_properties) ⇒ Object

テストを再実行する



54
55
56
# File 'lib/jiji/service/process_service.rb', line 54

def restart( process_id, agent_properties )
  @process_manager.restart_test(process_id, agent_properties)
end

#set(process_id, setting) ⇒ Object

プロセスの設定を更新する。



23
24
25
# File 'lib/jiji/service/process_service.rb', line 23

def set( process_id, setting )
  @process_manager.set( process_id, setting )
end

#status(process_ids = []) ⇒ Object

テストの状態を取得する



35
36
37
38
39
40
# File 'lib/jiji/service/process_service.rb', line 35

def status( process_ids=[] )
  process_ids.inject([]) {|buff,id|
    p = @process_manager.get( id )
    buff << extract_properties( p )
  }
end

#stop(process_id, agent_properties) ⇒ Object

テストの実行をキャンセルする



48
49
50
51
# File 'lib/jiji/service/process_service.rb', line 48

def stop( process_id, agent_properties )
  @process_manager.get( process_id ).stop
  :success
end