ucb_deployer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,104 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe ConfluenceDeployer do
4
+ before(:each) do
5
+ @cdeprc_file = File.expand_path(File.dirname(__FILE__) + '/../fixtures/dot_cdeprc')
6
+ @bad_cdeprc_file = File.expand_path(File.dirname(__FILE__) + '/../fixtures/bad_dot_cdeprc')
7
+ @cdep = ConfluenceDeployer.new(@cdeprc_file)
8
+ end
9
+
10
+
11
+ describe "#load_config" do
12
+ it "should load configuration options" do
13
+ @cdep.build_dir.should == "/path/to/build_dir"
14
+ @cdep.deploy_dir.should == "/path/to/deploy_dir"
15
+ @cdep.war_name.should == "war_name"
16
+ @cdep.svn_project_url.should == "svn.berkeley.edu/svn/ist-svn/berkeley/projects/ist/as/webapps/confluence_archives/tags"
17
+ end
18
+
19
+ it "should raise error for invalid config options" do
20
+ lambda { @cdep.load_config(@bad_cdeprc_file) }.should raise_error(ConfluenceDeployer::ConfigError)
21
+ end
22
+ end
23
+
24
+
25
+ describe "#config_web_xml" do
26
+ it "should configure souldwing (CAS auth) in web.xml" do
27
+ @cdep.build_dir = TEST_BUILD_DIR
28
+ # just checking if spec_helper did the right
29
+ File.exists?(@cdep.web_xml).should be_true
30
+
31
+ @cdep.config_web_xml
32
+ File.exists?(@cdep.web_xml).should be_true
33
+ lines = File.readlines(@cdep.web_xml)
34
+ lines.any? { |l| l =~ /<\?xml version="1\.0" encoding="UTF-8"\?>/ }.should be_true
35
+ lines.any? { |l| l =~ /<web-app>/ }.should be_true
36
+ lines.any? { |l| l =~ /#{@cdep.cas_server_url}/ }.should be_true
37
+ lines.any? { |l| l =~ /#{@cdep.cas_service_url}/ }.should be_true
38
+ lines.any? { |l| l =~ /<\/web-app>/ }.should be_true
39
+ end
40
+ end
41
+
42
+
43
+ describe "#config_seraph_config_xml" do
44
+ it "should configure the soulwing (CAS) authenticator in seraph_config.xml" do
45
+ @cdep.build_dir = TEST_BUILD_DIR
46
+ # just checking if spec_helper did the right
47
+ File.exists?(@cdep.seraph_config_xml).should be_true
48
+
49
+ @cdep.config_seraph_config_xml
50
+ File.exists?(@cdep.seraph_config_xml).should be_true
51
+ lines = File.readlines(@cdep.seraph_config_xml)
52
+ lines.any? { |l| l =~ /<security-config>/ }.should be_true
53
+ lines.any? { |l| l =~ /#{Regexp.quote(@cdep.cas_authenticator_class)}/ }.should be_true
54
+ lines.any? { |l| l =~ /<\/security-config>/ }.should be_true
55
+ end
56
+ end
57
+
58
+
59
+ describe "#config_confluence_init_props" do
60
+ it "should configure confluence-init.properties" do
61
+ @cdep.build_dir = TEST_BUILD_DIR
62
+ # just checking if spec_helper did the right
63
+ File.exists?(@cdep.confluence_init_properties).should be_true
64
+
65
+ @cdep.config_confluence_init_properties
66
+ File.exists?(@cdep.confluence_init_properties).should be_true
67
+ lines = File.readlines(@cdep.confluence_init_properties)
68
+ lines.any? { |l| l =~ /confluence.home=#{@cdep.confluence_home_dir}/ }.should be_true
69
+ end
70
+ end
71
+
72
+
73
+ describe "#reshuffle_jars" do
74
+ it "should work" do
75
+ @cdep.build_dir = TEST_BUILD_DIR
76
+ @cdep.reshuffle_jars
77
+ Dir["#{@cdep.build_dir}/confluence/src/confluence/WEB-INF/lib/soulwing-casclient-*"].should_not be_empty
78
+ Dir["#{@cdep.build_dir}/confluence/src/confluence/WEB-INF/lib/postgresql-*"].should be_empty
79
+ end
80
+ end
81
+
82
+
83
+ describe "#build" do
84
+ it "should work" do
85
+ @cdep.build_dir = TEST_BUILD_DIR
86
+ @cdep.should_receive(:exec).with("sh #{@cdep.build_dir}/confluence/src/build.sh")
87
+ @cdep.build
88
+ end
89
+ end
90
+
91
+
92
+ describe "#export" do
93
+ it "should work" do
94
+ cdep = ConfluenceDeployer.new(@cdeprc_file)
95
+ cdep.build_dir = TEST_BUILD_DIR
96
+ cdep.version = "3.2.1_01"
97
+ arg = "svn export svn+ssh://#{cdep.svn_username}@#{cdep.svn_project_url}/confluence-#{cdep.version}"
98
+ cdep.should_receive("`").with(arg).and_return(nil)
99
+ FileUtils.should_receive("mv")
100
+ cdep.export()
101
+ end
102
+ end
103
+
104
+ end
@@ -0,0 +1 @@
1
+ bad_config: you_suck
@@ -0,0 +1,41 @@
1
+ # This file allows you to set the directory for Confluence to store its configuration files.
2
+ #
3
+ ###########################
4
+ # Note for Windows Users #
5
+ ###########################
6
+ #
7
+ # Each backslash in your path must be written as a forward slash.
8
+ # - For example:
9
+ # c:\confluence\data
10
+ #
11
+ # should be written as:
12
+ #
13
+ # c:/confluence/data
14
+
15
+ ###########################
16
+ # Note for Unix Users #
17
+ ###########################
18
+ # - For example:
19
+ # confluence.home=/var/confluence
20
+ #
21
+ # NOTE: If the path of your confluence.home directory contains symlinks,
22
+ # please set confluence.home to the absolute path, otherwise problems may occur.
23
+ # - For example:
24
+ # confluence.home=/data/confluence/ (where /data is a symlink to -> /var/data/)
25
+ # should be written as:
26
+ # confluence.home=/var/data/confluence/
27
+
28
+ ###########################
29
+ # Configuration Directory #
30
+ ###########################
31
+
32
+ # specify your directory below (don't forget to remove the '#' in front)
33
+
34
+ # confluence.home=c:/confluence/data
35
+
36
+ ###########################
37
+ # Daily Backups Directory #
38
+ ###########################
39
+
40
+ ## Set this to true to enable setting of the daily backups directory in the admin section.
41
+ #confluence.backup.path.set.allowed=false
@@ -0,0 +1,7 @@
1
+ build_dir: /path/to/build_dir
2
+ deploy_dir: /path/to/deploy_dir
3
+ war_name: war_name
4
+ svn_username: runner
5
+ svn_project_url: svn.berkeley.edu/svn/ist-svn/berkeley/projects/ist/as/webapps/confluence_archives/tags
6
+ cas_server_url: https://auth.berkeley.edu/cas
7
+ cas_service_url: https://wikihub.berkeley.edu
@@ -0,0 +1,46 @@
1
+ <security-config>
2
+ <parameters>
3
+ <init-param>
4
+ <param-name>login.url</param-name>
5
+ <param-value>/login.action?os_destination=${originalurl}</param-value>
6
+ </init-param>
7
+ <init-param>
8
+ <param-name>link.login.url</param-name>
9
+ <param-value>/login.action</param-value>
10
+ </init-param>
11
+ <init-param>
12
+ <param-name>cookie.encoding</param-name>
13
+ <param-value>cNf</param-value>
14
+ </init-param>
15
+ <init-param>
16
+ <param-name>login.cookie.key</param-name>
17
+ <param-value>seraph.confluence</param-value>
18
+ </init-param>
19
+
20
+ <!--only basic authentication available-->
21
+ <init-param>
22
+ <param-name>authentication.type</param-name>
23
+ <param-value>os_authType</param-value>
24
+ </init-param>
25
+ </parameters>
26
+
27
+ <rolemapper class="com.atlassian.confluence.security.ConfluenceRoleMapper"/>
28
+ <controller class="com.atlassian.confluence.setup.seraph.ConfluenceSecurityController"/>
29
+ <authenticator class="com.atlassian.confluence.user.ConfluenceAuthenticator"/>
30
+
31
+ <services>
32
+ <service class="com.atlassian.seraph.service.PathService">
33
+ <init-param>
34
+ <param-name>config.file</param-name>
35
+ <param-value>seraph-paths.xml</param-value>
36
+ </init-param>
37
+ </service>
38
+ </services>
39
+
40
+ <elevatedsecurityguard class="com.atlassian.confluence.security.seraph.ConfluenceElevatedSecurityGuard"/>
41
+
42
+ <interceptors>
43
+ <interceptor name="session-invalidator" class="com.atlassian.confluence.security.seraph.SessionInvalidatingLoginInterceptor"/>
44
+ <interceptor name="login-logger" class="com.atlassian.confluence.user.ConfluenceLoginInterceptor"/>
45
+ </interceptors>
46
+ </security-config>