kalibro_gem 0.0.1.rc7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +21 -0
- data/AUTHORS +4 -0
- data/COPYING +674 -0
- data/COPYING.LESSER +165 -0
- data/Gemfile +4 -0
- data/README.md +77 -0
- data/Rakefile +6 -0
- data/cucumber.yml +1 -0
- data/features/base_tool/all_names.feature +8 -0
- data/features/base_tool/find_by_name.feature +12 -0
- data/features/configuration/all.feature +10 -0
- data/features/metric_configuration/find.feature +18 -0
- data/features/metric_configuration/metric_configurations_of.feature +18 -0
- data/features/metric_result/descendant_results.feature +19 -0
- data/features/metric_result/history_of.feature +20 -0
- data/features/metric_result/metric_results_of.feature +19 -0
- data/features/module_result/children.feature +18 -0
- data/features/module_result/find.feature +15 -0
- data/features/module_result/history_of.feature +11 -0
- data/features/processing/first_processing_after.feature +18 -0
- data/features/processing/first_processing_of.feature +18 -0
- data/features/processing/has_processing.feature +18 -0
- data/features/processing/has_processing_after.feature +18 -0
- data/features/processing/has_processing_before.feature +18 -0
- data/features/processing/has_ready_processing.feature +18 -0
- data/features/processing/last_processing_before.feature +18 -0
- data/features/processing/last_processing_of.feature +18 -0
- data/features/processing/last_processing_state_of.feature +18 -0
- data/features/processing/last_ready_processing_of.feature +18 -0
- data/features/processing/processing_of.feature +32 -0
- data/features/processing/processing_with_date_of.feature +32 -0
- data/features/project/all.feature +10 -0
- data/features/project/creation.feature +9 -0
- data/features/project/destroy.feature +10 -0
- data/features/project/exists.feature +9 -0
- data/features/project/find.feature +10 -0
- data/features/range/ranges_of.feature +22 -0
- data/features/range/save.feature +32 -0
- data/features/reading/find.feature +11 -0
- data/features/reading/readings_of.feature +11 -0
- data/features/reading_group/all.feature +10 -0
- data/features/repository/all.feature +14 -0
- data/features/repository/cancel_processing.feature +14 -0
- data/features/repository/exists.feature +14 -0
- data/features/repository/find.feature +14 -0
- data/features/repository/of.feature +15 -0
- data/features/repository/process.feature +16 -0
- data/features/repository/types.feature +9 -0
- data/features/step_definitions/base_tool_steps.rb +28 -0
- data/features/step_definitions/configuration_steps.rb +11 -0
- data/features/step_definitions/metric_configuration_steps.rb +52 -0
- data/features/step_definitions/metric_result_steps.rb +29 -0
- data/features/step_definitions/metric_steps.rb +3 -0
- data/features/step_definitions/module_result_steps.rb +30 -0
- data/features/step_definitions/processing_steps.rb +91 -0
- data/features/step_definitions/project_steps.rb +48 -0
- data/features/step_definitions/range_steps.rb +41 -0
- data/features/step_definitions/reading_group_steps.rb +19 -0
- data/features/step_definitions/reading_steps.rb +20 -0
- data/features/step_definitions/repository_steps.rb +61 -0
- data/features/support/env.rb +25 -0
- data/features/support/kalibro_cucumber_helpers.yml.sample +10 -0
- data/kalibro_gem.gemspec +48 -0
- data/lib/kalibro_gem.rb +61 -0
- data/lib/kalibro_gem/entities.rb +37 -0
- data/lib/kalibro_gem/entities/base_tool.rb +54 -0
- data/lib/kalibro_gem/entities/configuration.rb +33 -0
- data/lib/kalibro_gem/entities/date_metric_result.rb +39 -0
- data/lib/kalibro_gem/entities/date_module_result.rb +39 -0
- data/lib/kalibro_gem/entities/metric.rb +21 -0
- data/lib/kalibro_gem/entities/metric_configuration.rb +70 -0
- data/lib/kalibro_gem/entities/metric_configuration_snapshot.rb +57 -0
- data/lib/kalibro_gem/entities/metric_result.rb +74 -0
- data/lib/kalibro_gem/entities/model.rb +162 -0
- data/lib/kalibro_gem/entities/module.rb +27 -0
- data/lib/kalibro_gem/entities/module_result.rb +77 -0
- data/lib/kalibro_gem/entities/process_time.rb +31 -0
- data/lib/kalibro_gem/entities/processing.rb +113 -0
- data/lib/kalibro_gem/entities/project.rb +34 -0
- data/lib/kalibro_gem/entities/range.rb +75 -0
- data/lib/kalibro_gem/entities/range_snapshot.rb +37 -0
- data/lib/kalibro_gem/entities/reading.rb +51 -0
- data/lib/kalibro_gem/entities/reading_group.rb +43 -0
- data/lib/kalibro_gem/entities/repository.rb +86 -0
- data/lib/kalibro_gem/entities/repository_observer.rb +50 -0
- data/lib/kalibro_gem/entities/stack_trace_element.rb +31 -0
- data/lib/kalibro_gem/entities/throwable.rb +42 -0
- data/lib/kalibro_gem/errors.rb +18 -0
- data/lib/kalibro_gem/errors/record_not_found.rb +22 -0
- data/lib/kalibro_gem/errors/standard.rb +24 -0
- data/lib/kalibro_gem/helpers/aggregation_options.rb +25 -0
- data/lib/kalibro_gem/helpers/hash_converters.rb +48 -0
- data/lib/kalibro_gem/helpers/request_methods.rb +47 -0
- data/lib/kalibro_gem/helpers/xml_converters.rb +20 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers.rb +40 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers/configuration.rb +39 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers/hooks.rb +50 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers/scripts/delete_all_kalibro_entries.sh +23 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers/scripts/prepare_kalibro_query_file.sh +38 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers/scripts/put_kalibro_on_test_mode.sh +35 -0
- data/lib/kalibro_gem/kalibro_cucumber_helpers/scripts/return_kalibro_from_test_mode.sh +26 -0
- data/lib/kalibro_gem/version.rb +19 -0
- data/lib/rake/test_task.rb +57 -0
- data/spec/entities/base_tool_spec.rb +168 -0
- data/spec/entities/configuration_spec.rb +61 -0
- data/spec/entities/date_metric_result_spec.rb +62 -0
- data/spec/entities/date_module_result_spec.rb +61 -0
- data/spec/entities/metric_configuration_snapshot_spec.rb +107 -0
- data/spec/entities/metric_configuration_spec.rb +149 -0
- data/spec/entities/metric_result_spec.rb +201 -0
- data/spec/entities/metric_spec.rb +47 -0
- data/spec/entities/model_spec.rb +275 -0
- data/spec/entities/module_result_spec.rb +163 -0
- data/spec/entities/process_time_spec.rb +33 -0
- data/spec/entities/processing_spec.rb +334 -0
- data/spec/entities/project_spec.rb +68 -0
- data/spec/entities/range_snapshot_spec.rb +50 -0
- data/spec/entities/range_spec.rb +181 -0
- data/spec/entities/reading_group_spec.rb +90 -0
- data/spec/entities/reading_spec.rb +106 -0
- data/spec/entities/repository_observer_spec.rb +123 -0
- data/spec/entities/repository_spec.rb +191 -0
- data/spec/entities/stack_trace_element_spec.rb +26 -0
- data/spec/entities/throwable_spec.rb +51 -0
- data/spec/factories/base_tools.rb +31 -0
- data/spec/factories/configurations.rb +29 -0
- data/spec/factories/date_metric_results.rb +28 -0
- data/spec/factories/date_module_results.rb +22 -0
- data/spec/factories/metric_configurations.rb +28 -0
- data/spec/factories/metric_configurations_snapshot.rb +26 -0
- data/spec/factories/metric_results.rb +24 -0
- data/spec/factories/metrics.rb +35 -0
- data/spec/factories/models.rb +20 -0
- data/spec/factories/module_results.rb +33 -0
- data/spec/factories/modules.rb +22 -0
- data/spec/factories/process_times.rb +27 -0
- data/spec/factories/processings.rb +25 -0
- data/spec/factories/projects.rb +29 -0
- data/spec/factories/ranges.rb +30 -0
- data/spec/factories/ranges_snapshot.rb +26 -0
- data/spec/factories/reading_groups.rb +23 -0
- data/spec/factories/readings.rb +25 -0
- data/spec/factories/repositories.rb +34 -0
- data/spec/factories/repository_observers.rb +24 -0
- data/spec/factories/stack_trace_elements.rb +24 -0
- data/spec/factories/throwables.rb +23 -0
- data/spec/helpers/aggregation_options_spec.rb +31 -0
- data/spec/helpers/hash_converters_spec.rb +111 -0
- data/spec/helpers/xml_converters_spec.rb +64 -0
- data/spec/kalibro_entities_spec.rb +108 -0
- data/spec/savon/fixtures/config.yml +1 -0
- data/spec/savon/fixtures/invalid_config.yml +2 -0
- data/spec/savon/fixtures/project/does_not_exists.xml +1 -0
- data/spec/savon/savon_test_helper.rb +14 -0
- data/spec/spec_helper.rb +60 -0
- metadata +463 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'kalibro_gem/errors/standard'
|
18
|
+
require 'kalibro_gem/errors/record_not_found'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
module KalibroGem
|
18
|
+
module Errors
|
19
|
+
class RecordNotFound < Standard
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
#Inspired on:
|
18
|
+
#https://github.com/rails/rails/blob/master/activerecord/lib/active_record/errors.rb
|
19
|
+
module KalibroGem
|
20
|
+
module Errors
|
21
|
+
class Standard < StandardError
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
module AggregationOptions
|
18
|
+
#TODO: internationalization
|
19
|
+
def all_with_label
|
20
|
+
[
|
21
|
+
["Average","AVERAGE"], ["Median", "MEDIAN"], ["Maximum", "MAXIMUM"], ["Minimum", "MINIMUM"],
|
22
|
+
["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]
|
23
|
+
]
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'date'
|
18
|
+
require 'kalibro_gem/helpers/xml_converters'
|
19
|
+
|
20
|
+
module HashConverters
|
21
|
+
include XMLConverters
|
22
|
+
|
23
|
+
#FIXME: we can think about a better name. This method actually receives an DateTime and converts it to string
|
24
|
+
def date_with_milliseconds(date)
|
25
|
+
milliseconds = "." + (date.sec_fraction * 60 * 60 * 24 * 1000).to_s
|
26
|
+
date.to_s[0..18] + milliseconds + date.to_s[19..-1]
|
27
|
+
end
|
28
|
+
|
29
|
+
def convert_to_hash(value)
|
30
|
+
return value if value.nil?
|
31
|
+
return value.collect { |element| convert_to_hash(element) } if value.is_a?(Array)
|
32
|
+
return value.to_hash if value.is_a?(KalibroGem::Entities::Model)
|
33
|
+
return date_with_milliseconds(value) if value.is_a?(DateTime)
|
34
|
+
return 'INF' if value.is_a?(Float) and value.infinite? == 1
|
35
|
+
return '-INF' if value.is_a?(Float) and value.infinite? == -1
|
36
|
+
value.to_s
|
37
|
+
end
|
38
|
+
|
39
|
+
def field_to_hash(field)
|
40
|
+
hash = Hash.new
|
41
|
+
field_value = send(field)
|
42
|
+
if !field_value.nil?
|
43
|
+
hash[field] = convert_to_hash(field_value)
|
44
|
+
hash = get_xml(field, field_value).merge(hash)
|
45
|
+
end
|
46
|
+
hash
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
module RequestMethods
|
18
|
+
def save_params
|
19
|
+
{instance_class_name.underscore.to_sym => self.to_hash}
|
20
|
+
end
|
21
|
+
|
22
|
+
def save_action
|
23
|
+
"save_#{instance_class_name.underscore}".to_sym
|
24
|
+
end
|
25
|
+
|
26
|
+
def destroy_action
|
27
|
+
"delete_#{instance_class_name.underscore}".to_sym
|
28
|
+
end
|
29
|
+
|
30
|
+
def destroy_params
|
31
|
+
{"#{instance_class_name.underscore}_id".to_sym => self.id}
|
32
|
+
end
|
33
|
+
|
34
|
+
module ClassMethods
|
35
|
+
def exists_action
|
36
|
+
"#{class_name.underscore}_exists".to_sym
|
37
|
+
end
|
38
|
+
|
39
|
+
def id_params(id)
|
40
|
+
{"#{class_name.underscore}_id".to_sym => id}
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_action
|
44
|
+
"get_#{class_name.underscore}".to_sym
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module XMLConverters
|
2
|
+
def xml_instance_class_name(object)
|
3
|
+
xml_name = object.class.name
|
4
|
+
xml_name["KalibroGem::Entities::"] = "" if xml_name.start_with?("KalibroGem::Entities::")
|
5
|
+
xml_name[0..0] = xml_name[0..0].downcase
|
6
|
+
xml_name + "Xml"
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_xml(field, field_value)
|
10
|
+
hash = Hash.new
|
11
|
+
if field_value.is_a?(KalibroGem::Entities::Model)
|
12
|
+
hash = {:attributes! => {}}
|
13
|
+
hash[:attributes!][field.to_sym] = {
|
14
|
+
'xmlns:xsi'=> 'http://www.w3.org/2001/XMLSchema-instance',
|
15
|
+
'xsi:type' => 'kalibro:' + xml_instance_class_name(field_value)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
hash
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'yaml'
|
18
|
+
require 'kalibro_gem/kalibro_cucumber_helpers/configuration'
|
19
|
+
|
20
|
+
module KalibroGem
|
21
|
+
module KalibroCucumberHelpers
|
22
|
+
@configuration = KalibroGem::KalibroCucumberHelpers::Configuration.new
|
23
|
+
|
24
|
+
def KalibroCucumberHelpers.configure(&config_block)
|
25
|
+
config_block.call(@configuration)
|
26
|
+
end
|
27
|
+
|
28
|
+
def KalibroCucumberHelpers.configure_from_yml(file_path)
|
29
|
+
configuration = YAML.load(File.open("features/support/kalibro_cucumber_helpers.yml"))
|
30
|
+
|
31
|
+
configuration["kalibro_cucumber_helpers"].each do |config, value|
|
32
|
+
@configuration.send("#{config}=", value)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def KalibroCucumberHelpers.configuration
|
37
|
+
@configuration
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
module KalibroGem
|
18
|
+
module KalibroCucumberHelpers
|
19
|
+
class Configuration
|
20
|
+
attr_accessor :database, :user, :password,
|
21
|
+
:query_file_path, :psql_file_path, :kalibro_home,
|
22
|
+
:tomcat_user, :tomcat_group, :tomcat_restart_command
|
23
|
+
|
24
|
+
def initialize(attributes={})
|
25
|
+
self.database = "kalibro_test"
|
26
|
+
self.user = "kalibro"
|
27
|
+
self.password = "kalibro"
|
28
|
+
self.psql_file_path = "/tmp/PostgreSQL.sql"
|
29
|
+
self.query_file_path = "/tmp/query"
|
30
|
+
self.kalibro_home = "/usr/share/tomcat6/.kalibro"
|
31
|
+
self.tomcat_user = "tomcat6"
|
32
|
+
self.tomcat_group = "tomcat6"
|
33
|
+
self.tomcat_restart_command = "sudo\\ service\\ tomcat6\\ restart"
|
34
|
+
|
35
|
+
attributes.each { |field, value| send("#{field}=", value) if respond_to?("#{field}=") }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# This file is part of KalibroGem
|
2
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
3
|
+
#
|
4
|
+
# This program is free software: you can redistribute it and/or modify
|
5
|
+
# it under the terms of the GNU General Public License as published by
|
6
|
+
# the Free Software Foundation, either version 3 of the License, or
|
7
|
+
# (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
16
|
+
|
17
|
+
require 'kalibro_gem/kalibro_cucumber_helpers'
|
18
|
+
|
19
|
+
Before do
|
20
|
+
if !$dunit
|
21
|
+
command = "#{__dir__}/scripts/put_kalibro_on_test_mode.sh \\
|
22
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.kalibro_home} \\
|
23
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.tomcat_restart_command} \\
|
24
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.tomcat_user} \\
|
25
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.tomcat_group}"
|
26
|
+
system command
|
27
|
+
|
28
|
+
command = "#{__dir__}/scripts/prepare_kalibro_query_file.sh \\
|
29
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.psql_file_path} \\
|
30
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.query_file_path}"
|
31
|
+
system command
|
32
|
+
|
33
|
+
$dunit = true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
After ('@kalibro_restart') do
|
38
|
+
command = "#{__dir__}/scripts/delete_all_kalibro_entries.sh \\
|
39
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.password} \\
|
40
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.database} \\
|
41
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.query_file_path}"
|
42
|
+
system command
|
43
|
+
end
|
44
|
+
|
45
|
+
at_exit do
|
46
|
+
command = "#{__dir__}/scripts/return_kalibro_from_test_mode.sh \\
|
47
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.kalibro_home} \\
|
48
|
+
#{KalibroGem::KalibroCucumberHelpers.configuration.tomcat_restart_command}"
|
49
|
+
system command
|
50
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This file is part of KalibroGem
|
4
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
5
|
+
#
|
6
|
+
# This program is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
PASSWORD=$1
|
20
|
+
DATABASE=$2
|
21
|
+
QUERYFILE=$3
|
22
|
+
|
23
|
+
sudo su - postgres -c "export PGPASSWORD=$PASSWORD && psql -q -d $DATABASE -f $QUERYFILE"
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This file is part of KalibroGem
|
4
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
5
|
+
#
|
6
|
+
# This program is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
PSQLFILE=$1
|
20
|
+
QUERYFILE=$2
|
21
|
+
|
22
|
+
if ! [ -f $PSQLFILE ]
|
23
|
+
then wget https://raw.github.com/mezuro/kalibro/kalibro-dev/KalibroCore/src/META-INF/PostgreSQL.sql -O $PSQLFILE
|
24
|
+
fi
|
25
|
+
|
26
|
+
DROPLIMIT="END OF DROP TABLES"
|
27
|
+
RANGE=$(grep -n "$DROPLIMIT" $PSQLFILE | cut -d":" -f1)
|
28
|
+
START=1
|
29
|
+
END=$(($RANGE - 1))
|
30
|
+
CUT=$START,$END\!d
|
31
|
+
REPLACE="s/DROP TABLE IF EXISTS sequences,/TRUNCATE/"
|
32
|
+
|
33
|
+
if [ -f $QUERYFILE ]
|
34
|
+
then sudo rm $QUERYFILE
|
35
|
+
fi
|
36
|
+
|
37
|
+
sed -e "$CUT" -e "$REPLACE" $PSQLFILE > $QUERYFILE
|
38
|
+
sudo chown postgres.postgres $QUERYFILE
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# This file is part of KalibroGem
|
4
|
+
# Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
|
5
|
+
#
|
6
|
+
# This program is free software: you can redistribute it and/or modify
|
7
|
+
# it under the terms of the GNU General Public License as published by
|
8
|
+
# the Free Software Foundation, either version 3 of the License, or
|
9
|
+
# (at your option) any later version.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
# GNU General Public License for more details.
|
15
|
+
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
# where are your .kalibro dir?
|
20
|
+
KALIBRO_HOME=$1
|
21
|
+
|
22
|
+
TOMCAT_RESTART_COMMAND=$2
|
23
|
+
TOMCAT_USER=$3
|
24
|
+
TOMCAT_GROUP=$4
|
25
|
+
|
26
|
+
# create a kalibro test dir
|
27
|
+
echo "--> Creating tests directory"
|
28
|
+
sudo mkdir $KALIBRO_HOME/tests
|
29
|
+
echo "--> Copying test settings"
|
30
|
+
sudo cp $KALIBRO_HOME/kalibro_test.settings $KALIBRO_HOME/tests/kalibro.settings
|
31
|
+
echo "--> Changing owner of tests directory to tomcat6"
|
32
|
+
sudo chown -R $TOMCAT_USER:$TOMCAT_GROUP $KALIBRO_HOME/tests
|
33
|
+
|
34
|
+
# you must restart tomcat6
|
35
|
+
$TOMCAT_RESTART_COMMAND
|