And(/^I am going to run an export$/) do step %Q{I specify the command "export"} s3 = AWS::S3.new(:access_key_id => 'AKIAIW6QO5LAD6KXBDUA', :secret_access_key => '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') bucket = s3.buckets['insxsync-test'] bucket.objects.each do |obj| obj.delete end bucket.objects['insxsync.test'].write("This file was downloaded successfully!") if not @config_dir.nil? Dir.mkdir(@config_dir) if not File.exists?(@config_dir) end end And(/^I do not want to export any databases$/) do step %Q{I specify "--no-export-data"} end And(/^I do not want to export any configurations$/) do step %Q{I specify "--no-export-configs"} end And(/^The synchronization export should be successful$/) do s3 = AWS::S3.new(:access_key_id => 'AKIAIW6QO5LAD6KXBDUA', :secret_access_key => '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') bucket = s3.buckets['insxsync-test'] folders = bucket.as_tree.children.select(&:branch?).collect(&:prefix).map(&:chop) raise "Synchronization point folder not found!" if folders.count != 1 end And(/^The synchronization point should (not )?contain configurations$/) do |arg| s3 = AWS::S3.new(:access_key_id => 'AKIAIW6QO5LAD6KXBDUA', :secret_access_key => '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') bucket = s3.buckets['insxsync-test'] prefix = bucket.as_tree.children.select(&:branch?).collect(&:prefix).map(&:chop)[0] folders = bucket.as_tree(:prefix => prefix).children.select(&:branch?).collect(&:prefix).map(&:chop) folders.map! {|folder| folder.gsub("#{prefix}/", '')} if arg.nil? raise "Configurations do not exist in synchronization point!" if not folders.include?('configs') else raise "Configurations exist in synchronization point!" if folders.include?('configs') end end And(/^The synchronization point should (not )?contain databases/) do |arg| s3 = AWS::S3.new(:access_key_id => 'AKIAIW6QO5LAD6KXBDUA', :secret_access_key => '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') bucket = s3.buckets['insxsync-test'] prefix = bucket.as_tree.children.select(&:branch?).collect(&:prefix).map(&:chop)[0] folders = bucket.as_tree(:prefix => prefix).children.select(&:branch?).collect(&:prefix).map(&:chop) folders.map! {|folder| folder.gsub("#{prefix}/", '')} if arg.nil? raise "Databases no dot exist in synchronization point!" if not folders.include?('database') else raise "Databases exist in synchronization point!" if folders.include?('database') end end And(/^The synchronization export should not exist$/) do s3 = AWS::S3.new(:access_key_id => 'AKIAIW6QO5LAD6KXBDUA', :secret_access_key => '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') bucket = s3.buckets['insxsync-test'] folders = bucket.as_tree.children.select(&:branch?) raise "Synchronization point folder exists!"if folders.count != 0 end