buildr 1.4.12-x86-mswin32 → 1.4.13-x86-mswin32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/CHANGELOG +62 -0
- data/addon/buildr/checkstyle.rb +6 -4
- data/addon/buildr/gpg.rb +9 -2
- data/addon/buildr/gwt.rb +1 -0
- data/buildr.gemspec +18 -20
- data/doc/download.textile +30 -6
- data/doc/index.textile +21 -9
- data/doc/packaging.textile +29 -0
- data/lib/buildr.rb +3 -0
- data/lib/buildr/core/application.rb +24 -0
- data/lib/buildr/core/assets.rb +93 -0
- data/lib/buildr/core/build.rb +3 -2
- data/lib/buildr/core/common.rb +3 -2
- data/lib/buildr/core/compile.rb +0 -1
- data/lib/buildr/core/generate.rb +2 -2
- data/lib/buildr/core/project.rb +1 -1
- data/lib/buildr/core/shell.rb +1 -1
- data/lib/buildr/core/transports.rb +4 -1
- data/lib/buildr/core/util.rb +8 -0
- data/lib/buildr/ide/idea.rb +267 -114
- data/lib/buildr/java/commands.rb +16 -2
- data/lib/buildr/java/packaging.rb +6 -4
- data/lib/buildr/java/pom.rb +1 -1
- data/lib/buildr/java/tests.rb +3 -3
- data/lib/buildr/packaging/archive.rb +4 -3
- data/lib/buildr/packaging/package.rb +0 -2
- data/lib/buildr/packaging/ziptask.rb +1 -1
- data/lib/buildr/version.rb +2 -2
- data/rakelib/rspec.rake +5 -49
- data/rakelib/stage.rake +7 -5
- data/spec/addon/jaxb_xjc_spec.rb +2 -2
- data/spec/core/application_spec.rb +8 -8
- data/spec/core/build_spec.rb +41 -41
- data/spec/core/common_spec.rb +3 -2
- data/spec/core/test_spec.rb +34 -34
- data/spec/core/transport_spec.rb +21 -17
- data/spec/ide/idea_spec.rb +707 -4
- data/spec/java/packaging_spec.rb +20 -0
- data/spec/java/tests_spec.rb +2 -2
- data/spec/packaging/packaging_spec.rb +0 -22
- metadata +54 -116
    
        data/spec/core/common_spec.rb
    CHANGED
    
    | @@ -98,7 +98,7 @@ describe Buildr.method(:download) do | |
| 98 98 | 
             
              before do
         | 
| 99 99 | 
             
                @content = 'we has download!'
         | 
| 100 100 | 
             
                @http = mock('http')
         | 
| 101 | 
            -
                @http.stub | 
| 101 | 
            +
                @http.stub(:request).and_return(Net::HTTPNotModified.new(nil, nil, nil))
         | 
| 102 102 | 
             
              end
         | 
| 103 103 |  | 
| 104 104 | 
             
              def tasks()
         | 
| @@ -595,13 +595,14 @@ end | |
| 595 595 | 
             
            describe Buildr::Options, 'proxy.exclude' do
         | 
| 596 596 | 
             
              before do
         | 
| 597 597 | 
             
                options.proxy.http = 'http://myproxy:8080'
         | 
| 598 | 
            +
                options.proxy.exclude.clear
         | 
| 598 599 | 
             
                @domain = 'domain'
         | 
| 599 600 | 
             
                @host = "host.#{@domain}"
         | 
| 600 601 | 
             
                @uri = URI("http://#{@host}")
         | 
| 601 602 | 
             
                @no_proxy_args = [@host, 80]
         | 
| 602 603 | 
             
                @proxy_args = @no_proxy_args + ['myproxy', 8080, nil, nil]
         | 
| 603 604 | 
             
                @http = mock('http')
         | 
| 604 | 
            -
                @http.stub | 
| 605 | 
            +
                @http.stub(:request).and_return(Net::HTTPNotModified.new(nil, nil, nil))
         | 
| 605 606 | 
             
              end
         | 
| 606 607 |  | 
| 607 608 | 
             
              it 'should be an array' do
         | 
    
        data/spec/core/test_spec.rb
    CHANGED
    
    | @@ -322,8 +322,8 @@ describe Buildr::TestTask, 'with passing tests' do | |
| 322 322 | 
             
                  define 'foo' do
         | 
| 323 323 | 
             
                    test.using(:junit)
         | 
| 324 324 | 
             
                    test.instance_eval do
         | 
| 325 | 
            -
                      @framework.stub | 
| 326 | 
            -
                      @framework.stub | 
| 325 | 
            +
                      @framework.stub(:tests).and_return(['PassingTest1', 'PassingTest2'])
         | 
| 326 | 
            +
                      @framework.stub(:run).and_return(['PassingTest1', 'PassingTest2'])
         | 
| 327 327 | 
             
                    end
         | 
| 328 328 | 
             
                  end
         | 
| 329 329 | 
             
                  project('foo').test
         | 
| @@ -367,8 +367,8 @@ describe Buildr::TestTask, 'with failed test' do | |
| 367 367 | 
             
                  define 'foo' do
         | 
| 368 368 | 
             
                    test.using(:junit)
         | 
| 369 369 | 
             
                    test.instance_eval do
         | 
| 370 | 
            -
                      @framework.stub | 
| 371 | 
            -
                      @framework.stub | 
| 370 | 
            +
                      @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
         | 
| 371 | 
            +
                      @framework.stub(:run).and_return(['PassingTest'])
         | 
| 372 372 | 
             
                    end
         | 
| 373 373 | 
             
                  end
         | 
| 374 374 | 
             
                  project('foo').test
         | 
| @@ -633,8 +633,8 @@ describe Buildr::TestTask, '#invoke' do | |
| 633 633 | 
             
                @test_task ||= define('foo') {
         | 
| 634 634 | 
             
                  test.using(:junit)
         | 
| 635 635 | 
             
                  test.instance_eval do
         | 
| 636 | 
            -
                    @framework.stub | 
| 637 | 
            -
                    @framework.stub | 
| 636 | 
            +
                    @framework.stub(:tests).and_return(['PassingTest'])
         | 
| 637 | 
            +
                    @framework.stub(:run).and_return(['PassingTest'])
         | 
| 638 638 | 
             
                  end
         | 
| 639 639 | 
             
                }.test
         | 
| 640 640 | 
             
              end
         | 
| @@ -844,10 +844,10 @@ describe 'test rule' do | |
| 844 844 | 
             
              it 'should reset tasks to specific pattern' do
         | 
| 845 845 | 
             
                define 'foo' do
         | 
| 846 846 | 
             
                  test.using(:junit)
         | 
| 847 | 
            -
                  test.instance_eval { @framework.stub | 
| 847 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 848 848 | 
             
                  define 'bar' do
         | 
| 849 849 | 
             
                    test.using(:junit)
         | 
| 850 | 
            -
                    test.instance_eval { @framework.stub | 
| 850 | 
            +
                    test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 851 851 | 
             
                  end
         | 
| 852 852 | 
             
                end
         | 
| 853 853 | 
             
                task('test:something').invoke
         | 
| @@ -860,7 +860,7 @@ describe 'test rule' do | |
| 860 860 | 
             
              it 'should apply *name* pattern' do
         | 
| 861 861 | 
             
                define 'foo' do
         | 
| 862 862 | 
             
                  test.using(:junit)
         | 
| 863 | 
            -
                  test.instance_eval { @framework.stub | 
| 863 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['prefix-something-suffix']) }
         | 
| 864 864 | 
             
                end
         | 
| 865 865 | 
             
                task('test:something').invoke
         | 
| 866 866 | 
             
                project('foo').test.tests.should include('prefix-something-suffix')
         | 
| @@ -869,7 +869,7 @@ describe 'test rule' do | |
| 869 869 | 
             
              it 'should not apply *name* pattern if asterisks used' do
         | 
| 870 870 | 
             
                define 'foo' do
         | 
| 871 871 | 
             
                  test.using(:junit)
         | 
| 872 | 
            -
                  test.instance_eval { @framework.stub | 
| 872 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['prefix-something', 'prefix-something-suffix']) }
         | 
| 873 873 | 
             
                end
         | 
| 874 874 | 
             
                task('test:*something').invoke
         | 
| 875 875 | 
             
                project('foo').test.tests.should include('prefix-something')
         | 
| @@ -879,7 +879,7 @@ describe 'test rule' do | |
| 879 879 | 
             
              it 'should accept multiple tasks separated by commas' do
         | 
| 880 880 | 
             
                define 'foo' do
         | 
| 881 881 | 
             
                  test.using(:junit)
         | 
| 882 | 
            -
                  test.instance_eval { @framework.stub | 
| 882 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['foo', 'bar', 'baz']) }
         | 
| 883 883 | 
             
                end
         | 
| 884 884 | 
             
                task('test:foo,bar').invoke
         | 
| 885 885 | 
             
                project('foo').test.tests.should include('foo')
         | 
| @@ -899,7 +899,7 @@ describe 'test rule' do | |
| 899 899 | 
             
              it 'should execute the named tests even if the test task is not needed' do
         | 
| 900 900 | 
             
                define 'foo' do
         | 
| 901 901 | 
             
                  test.using(:junit)
         | 
| 902 | 
            -
                  test.instance_eval { @framework.stub | 
| 902 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 903 903 | 
             
                end
         | 
| 904 904 | 
             
                touch_last_successful_test_run project('foo').test
         | 
| 905 905 | 
             
                task('test:something').invoke
         | 
| @@ -909,7 +909,7 @@ describe 'test rule' do | |
| 909 909 | 
             
              it 'should not execute excluded tests' do
         | 
| 910 910 | 
             
                define 'foo' do
         | 
| 911 911 | 
             
                  test.using(:junit)
         | 
| 912 | 
            -
                  test.instance_eval { @framework.stub | 
| 912 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 913 913 | 
             
                end
         | 
| 914 914 | 
             
                task('test:*,-nothing').invoke
         | 
| 915 915 | 
             
                project('foo').test.tests.should include('something')
         | 
| @@ -932,7 +932,7 @@ describe 'test rule' do | |
| 932 932 | 
             
              it 'should not execute excluded tests with wildcards' do
         | 
| 933 933 | 
             
                define 'foo' do
         | 
| 934 934 | 
             
                  test.using(:junit)
         | 
| 935 | 
            -
                  test.instance_eval { @framework.stub | 
| 935 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 936 936 | 
             
                end
         | 
| 937 937 | 
             
                task('test:something,-s*,-n*').invoke
         | 
| 938 938 | 
             
                project('foo').test.tests.should_not include('something')
         | 
| @@ -942,7 +942,7 @@ describe 'test rule' do | |
| 942 942 | 
             
              it 'should execute all tests except excluded tests' do
         | 
| 943 943 | 
             
                define 'foo' do
         | 
| 944 944 | 
             
                  test.using(:junit)
         | 
| 945 | 
            -
                  test.instance_eval { @framework.stub | 
| 945 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'anything', 'nothing']) }
         | 
| 946 946 | 
             
                end
         | 
| 947 947 | 
             
                task('test:-nothing').invoke
         | 
| 948 948 | 
             
                project('foo').test.tests.should include('something', 'anything')
         | 
| @@ -953,7 +953,7 @@ describe 'test rule' do | |
| 953 953 | 
             
                define 'foo' do
         | 
| 954 954 | 
             
                  test.using(:junit)
         | 
| 955 955 | 
             
                  test.exclude 'something'
         | 
| 956 | 
            -
                  test.instance_eval { @framework.stub | 
| 956 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'anything', 'nothing']) }
         | 
| 957 957 | 
             
                end
         | 
| 958 958 | 
             
                task('test:-nothing').invoke
         | 
| 959 959 | 
             
                project('foo').test.tests.should include('something', 'anything')
         | 
| @@ -964,7 +964,7 @@ describe 'test rule' do | |
| 964 964 | 
             
                define 'foo' do
         | 
| 965 965 | 
             
                  test.using(:junit)
         | 
| 966 966 | 
             
                  test.include 'something'
         | 
| 967 | 
            -
                  test.instance_eval { @framework.stub | 
| 967 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 968 968 | 
             
                end
         | 
| 969 969 | 
             
                task('test:nothing').invoke
         | 
| 970 970 | 
             
                project('foo').test.tests.should include('nothing')
         | 
| @@ -974,7 +974,7 @@ describe 'test rule' do | |
| 974 974 | 
             
              it 'should not execute a test if it''s both included and excluded' do
         | 
| 975 975 | 
             
                define 'foo' do
         | 
| 976 976 | 
             
                  test.using(:junit)
         | 
| 977 | 
            -
                  test.instance_eval { @framework.stub | 
| 977 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['nothing']) }
         | 
| 978 978 | 
             
                end
         | 
| 979 979 | 
             
                task('test:nothing,-nothing').invoke
         | 
| 980 980 | 
             
                project('foo').test.tests.should_not include('nothing')
         | 
| @@ -983,7 +983,7 @@ describe 'test rule' do | |
| 983 983 | 
             
              it 'should not update the last successful test run timestamp' do
         | 
| 984 984 | 
             
                define 'foo' do
         | 
| 985 985 | 
             
                  test.using(:junit)
         | 
| 986 | 
            -
                  test.instance_eval { @framework.stub | 
| 986 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 987 987 | 
             
                end
         | 
| 988 988 | 
             
                a_second_ago = Time.now - 1
         | 
| 989 989 | 
             
                touch_last_successful_test_run project('foo').test, a_second_ago
         | 
| @@ -1000,8 +1000,8 @@ describe 'test failed' do | |
| 1000 1000 | 
             
                  define 'foo' do
         | 
| 1001 1001 | 
             
                    test.using(:junit)
         | 
| 1002 1002 | 
             
                    test.instance_eval do
         | 
| 1003 | 
            -
                      @framework.stub | 
| 1004 | 
            -
                      @framework.stub | 
| 1003 | 
            +
                      @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
         | 
| 1004 | 
            +
                      @framework.stub(:run).and_return(['PassingTest'])
         | 
| 1005 1005 | 
             
                    end
         | 
| 1006 1006 | 
             
                  end
         | 
| 1007 1007 | 
             
                  project('foo').test
         | 
| @@ -1012,8 +1012,8 @@ describe 'test failed' do | |
| 1012 1012 | 
             
                define 'foo' do
         | 
| 1013 1013 | 
             
                  test.using(:junit)
         | 
| 1014 1014 | 
             
                  test.instance_eval do
         | 
| 1015 | 
            -
                    @framework.stub | 
| 1016 | 
            -
                    @framework.stub | 
| 1015 | 
            +
                    @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
         | 
| 1016 | 
            +
                    @framework.stub(:run).and_return(['PassingTest'])
         | 
| 1017 1017 | 
             
                  end
         | 
| 1018 1018 | 
             
                end
         | 
| 1019 1019 | 
             
                write project('foo').path_to(:target, "junit-failed"), "FailingTest"
         | 
| @@ -1026,8 +1026,8 @@ describe 'test failed' do | |
| 1026 1026 | 
             
                define 'foo' do
         | 
| 1027 1027 | 
             
                  test.using(:junit).exclude('ExcludedTest')
         | 
| 1028 1028 | 
             
                  test.instance_eval do
         | 
| 1029 | 
            -
                    @framework.stub | 
| 1030 | 
            -
                    @framework.stub | 
| 1029 | 
            +
                    @framework.stub(:tests).and_return(['FailingTest', 'PassingTest', 'ExcludedTest'])
         | 
| 1030 | 
            +
                    @framework.stub(:run).and_return(['PassingTest'])
         | 
| 1031 1031 | 
             
                  end
         | 
| 1032 1032 | 
             
                end
         | 
| 1033 1033 | 
             
                write project('foo').path_to(:target, "junit-failed"), "FailingTest\nExcludedTest"
         | 
| @@ -1041,16 +1041,16 @@ describe 'test failed' do | |
| 1041 1041 | 
             
                  define 'foo' do
         | 
| 1042 1042 | 
             
                    test.using(:junit)
         | 
| 1043 1043 | 
             
                    test.instance_eval do
         | 
| 1044 | 
            -
                      @framework.stub | 
| 1045 | 
            -
                      @framework.stub | 
| 1044 | 
            +
                      @framework.stub(:tests).and_return(['PassingTest'])
         | 
| 1045 | 
            +
                      @framework.stub(:run).and_return(['PassingTest'])
         | 
| 1046 1046 | 
             
                    end
         | 
| 1047 1047 | 
             
                  end
         | 
| 1048 1048 | 
             
                  define 'bar' do
         | 
| 1049 1049 | 
             
                    test.using(:junit)
         | 
| 1050 1050 | 
             
                    test.enhance ["parent:foo:test"]
         | 
| 1051 1051 | 
             
                    test.instance_eval do
         | 
| 1052 | 
            -
                      @framework.stub | 
| 1053 | 
            -
                      @framework.stub | 
| 1052 | 
            +
                      @framework.stub(:tests).and_return(['FailingTest', 'PassingTest'])
         | 
| 1053 | 
            +
                      @framework.stub(:run).and_return(['PassingTest'])
         | 
| 1054 1054 | 
             
                    end
         | 
| 1055 1055 | 
             
                  end
         | 
| 1056 1056 | 
             
                end
         | 
| @@ -1268,10 +1268,10 @@ describe 'integration rule' do | |
| 1268 1268 | 
             
              it 'should reset tasks to specific pattern' do
         | 
| 1269 1269 | 
             
                define 'foo' do
         | 
| 1270 1270 | 
             
                  test.using :junit, :integration
         | 
| 1271 | 
            -
                  test.instance_eval { @framework.stub | 
| 1271 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 1272 1272 | 
             
                  define 'bar' do
         | 
| 1273 1273 | 
             
                    test.using :junit, :integration
         | 
| 1274 | 
            -
                    test.instance_eval { @framework.stub | 
| 1274 | 
            +
                    test.instance_eval { @framework.stub(:tests).and_return(['something', 'nothing']) }
         | 
| 1275 1275 | 
             
                  end
         | 
| 1276 1276 | 
             
                end
         | 
| 1277 1277 | 
             
                task('integration:something').invoke
         | 
| @@ -1284,7 +1284,7 @@ describe 'integration rule' do | |
| 1284 1284 | 
             
              it 'should apply *name* pattern' do
         | 
| 1285 1285 | 
             
                define 'foo' do
         | 
| 1286 1286 | 
             
                  test.using :junit, :integration
         | 
| 1287 | 
            -
                  test.instance_eval { @framework.stub | 
| 1287 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['prefix-something-suffix']) }
         | 
| 1288 1288 | 
             
                end
         | 
| 1289 1289 | 
             
                task('integration:something').invoke
         | 
| 1290 1290 | 
             
                project('foo').test.tests.should include('prefix-something-suffix')
         | 
| @@ -1293,7 +1293,7 @@ describe 'integration rule' do | |
| 1293 1293 | 
             
              it 'should not apply *name* pattern if asterisks used' do
         | 
| 1294 1294 | 
             
                define 'foo' do
         | 
| 1295 1295 | 
             
                  test.using :junit, :integration
         | 
| 1296 | 
            -
                  test.instance_eval { @framework.stub | 
| 1296 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['prefix-something', 'prefix-something-suffix']) }
         | 
| 1297 1297 | 
             
                end
         | 
| 1298 1298 | 
             
                task('integration:*something').invoke
         | 
| 1299 1299 | 
             
                project('foo').test.tests.should include('prefix-something')
         | 
| @@ -1303,7 +1303,7 @@ describe 'integration rule' do | |
| 1303 1303 | 
             
              it 'should accept multiple tasks separated by commas' do
         | 
| 1304 1304 | 
             
                define 'foo' do
         | 
| 1305 1305 | 
             
                  test.using :junit, :integration
         | 
| 1306 | 
            -
                  test.instance_eval { @framework.stub | 
| 1306 | 
            +
                  test.instance_eval { @framework.stub(:tests).and_return(['foo', 'bar', 'baz']) }
         | 
| 1307 1307 | 
             
                end
         | 
| 1308 1308 | 
             
                task('integration:foo,bar').invoke
         | 
| 1309 1309 | 
             
                project('foo').test.tests.should include('foo')
         | 
    
        data/spec/core/transport_spec.rb
    CHANGED
    
    | @@ -223,6 +223,10 @@ describe URI::FILE, '#write' do | |
| 223 223 | 
             
            end
         | 
| 224 224 |  | 
| 225 225 |  | 
| 226 | 
            +
            def default_http_headers
         | 
| 227 | 
            +
              {"Cache-Control" => "no-cache", "User-Agent" => "Buildr-#{Buildr::VERSION}"}
         | 
| 228 | 
            +
            end
         | 
| 229 | 
            +
             | 
| 226 230 | 
             
            describe URI::HTTP, '#read' do
         | 
| 227 231 | 
             
              before do
         | 
| 228 232 | 
             
                @proxy = 'http://john:smith@myproxy:8080'
         | 
| @@ -234,7 +238,7 @@ describe URI::HTTP, '#read' do | |
| 234 238 | 
             
                @no_proxy_args = [@host_domain, 80]
         | 
| 235 239 | 
             
                @proxy_args = @no_proxy_args + ['myproxy', 8080, 'john', 'smith']
         | 
| 236 240 | 
             
                @http = mock('http')
         | 
| 237 | 
            -
                @http.stub | 
| 241 | 
            +
                @http.stub(:request).and_yield(Net::HTTPNotModified.new(nil, nil, nil))
         | 
| 238 242 | 
             
              end
         | 
| 239 243 |  | 
| 240 244 | 
             
              it 'should not use proxy unless proxy is set' do
         | 
| @@ -305,8 +309,8 @@ describe URI::HTTP, '#read' do | |
| 305 309 |  | 
| 306 310 | 
             
              it 'should not die if content size is zero' do
         | 
| 307 311 | 
             
                ok = Net::HTTPOK.new(nil, nil, nil)
         | 
| 308 | 
            -
                ok.stub | 
| 309 | 
            -
                @http.stub | 
| 312 | 
            +
                ok.stub(:read_body)
         | 
| 313 | 
            +
                @http.stub(:request).and_yield(ok)
         | 
| 310 314 | 
             
                Net::HTTP.should_receive(:new).and_return(@http)
         | 
| 311 315 | 
             
                $stdout.should_receive(:isatty).and_return(false)
         | 
| 312 316 | 
             
                @uri.read :progress=>true
         | 
| @@ -328,16 +332,16 @@ describe URI::HTTP, '#read' do | |
| 328 332 | 
             
                redirect['Location'] = "http://#{@host_domain}/asdf"
         | 
| 329 333 |  | 
| 330 334 | 
             
                request1 = mock('request1')
         | 
| 331 | 
            -
                Net::HTTP::Get.should_receive(:new).once.with('/',  | 
| 335 | 
            +
                Net::HTTP::Get.should_receive(:new).once.with('/', default_http_headers).and_return(request1)
         | 
| 332 336 | 
             
                request1.should_receive(:basic_auth).with('john', 'secret')
         | 
| 333 337 | 
             
                @http.should_receive(:request).with(request1).and_yield(redirect)
         | 
| 334 338 |  | 
| 335 339 | 
             
                # The second request will be ok
         | 
| 336 340 | 
             
                ok = Net::HTTPOK.new(nil, nil, nil)
         | 
| 337 | 
            -
                ok.stub | 
| 341 | 
            +
                ok.stub(:read_body)
         | 
| 338 342 |  | 
| 339 343 | 
             
                request2 = mock('request2')
         | 
| 340 | 
            -
                Net::HTTP::Get.should_receive(:new).once.with("/asdf",  | 
| 344 | 
            +
                Net::HTTP::Get.should_receive(:new).once.with("/asdf", default_http_headers).and_return(request2)
         | 
| 341 345 | 
             
                request2.should_receive(:basic_auth).with('john', 'secret')
         | 
| 342 346 | 
             
                @http.should_receive(:request).with(request2).and_yield(ok)
         | 
| 343 347 |  | 
| @@ -346,8 +350,8 @@ describe URI::HTTP, '#read' do | |
| 346 350 |  | 
| 347 351 | 
             
              it 'should include the query part when performing HTTP GET' do
         | 
| 348 352 | 
             
                # should this test be generalized or shared with any other URI subtypes?
         | 
| 349 | 
            -
                Net::HTTP.stub | 
| 350 | 
            -
                Net::HTTP::Get.should_receive(:new).with(/#{Regexp.escape(@query)}$/,  | 
| 353 | 
            +
                Net::HTTP.stub(:new).and_return(@http)
         | 
| 354 | 
            +
                Net::HTTP::Get.should_receive(:new).with(/#{Regexp.escape(@query)}$/, default_http_headers)
         | 
| 351 355 | 
             
                @uri.read
         | 
| 352 356 | 
             
              end
         | 
| 353 357 |  | 
| @@ -359,8 +363,8 @@ describe URI::HTTP, '#write' do | |
| 359 363 | 
             
                @content = 'Readme. Please!'
         | 
| 360 364 | 
             
                @uri = URI('http://john:secret@host.domain/foo/bar/baz.jar')
         | 
| 361 365 | 
             
                @http = mock('Net::HTTP')
         | 
| 362 | 
            -
                @http.stub | 
| 363 | 
            -
                Net::HTTP.stub | 
| 366 | 
            +
                @http.stub(:request).and_return(Net::HTTPOK.new(nil, nil, nil))
         | 
| 367 | 
            +
                Net::HTTP.stub(:new).and_return(@http)
         | 
| 364 368 | 
             
              end
         | 
| 365 369 |  | 
| 366 370 | 
             
              it 'should open connection to HTTP server' do
         | 
| @@ -437,12 +441,12 @@ describe URI::SFTP, '#read' do | |
| 437 441 | 
             
                @ssh_session = mock('Net::SSH::Session')
         | 
| 438 442 | 
             
                @sftp_session = mock('Net::SFTP::Session')
         | 
| 439 443 | 
             
                @file_factory = mock('Net::SFTP::Operations::FileFactory')
         | 
| 440 | 
            -
                Net::SSH.stub | 
| 444 | 
            +
                Net::SSH.stub(:start).with('localhost', 'john', :password=>'secret', :port=>22).and_return(@ssh_session) do
         | 
| 441 445 | 
             
                  Net::SFTP::Session.should_receive(:new).with(@ssh_session).and_yield(@sftp_session).and_return(@sftp_session)
         | 
| 442 446 | 
             
                  @sftp_session.should_receive(:connect!).and_return(@sftp_session)
         | 
| 443 447 | 
             
                  @sftp_session.should_receive(:loop)
         | 
| 444 448 | 
             
                  @sftp_session.should_receive(:file).with.and_return(@file_factory)
         | 
| 445 | 
            -
                  @file_factory.stub | 
| 449 | 
            +
                  @file_factory.stub(:open)
         | 
| 446 450 | 
             
                  @ssh_session.should_receive(:close)
         | 
| 447 451 | 
             
                  @ssh_session
         | 
| 448 452 | 
             
                end
         | 
| @@ -485,15 +489,15 @@ describe URI::SFTP, '#write' do | |
| 485 489 | 
             
                @ssh_session = mock('Net::SSH::Session')
         | 
| 486 490 | 
             
                @sftp_session = mock('Net::SFTP::Session')
         | 
| 487 491 | 
             
                @file_factory = mock('Net::SFTP::Operations::FileFactory')
         | 
| 488 | 
            -
                Net::SSH.stub | 
| 492 | 
            +
                Net::SSH.stub(:start).with('localhost', 'john', :password=>'secret', :port=>22).and_return(@ssh_session) do
         | 
| 489 493 | 
             
                  Net::SFTP::Session.should_receive(:new).with(@ssh_session).and_yield(@sftp_session).and_return(@sftp_session)
         | 
| 490 494 | 
             
                  @sftp_session.should_receive(:connect!).and_return(@sftp_session)
         | 
| 491 495 | 
             
                  @sftp_session.should_receive(:loop)
         | 
| 492 | 
            -
                  @sftp_session.stub | 
| 493 | 
            -
                  @sftp_session.stub | 
| 494 | 
            -
                  @sftp_session.stub | 
| 496 | 
            +
                  @sftp_session.stub(:opendir!).and_return { fail }
         | 
| 497 | 
            +
                  @sftp_session.stub(:close)
         | 
| 498 | 
            +
                  @sftp_session.stub(:mkdir!)
         | 
| 495 499 | 
             
                  @sftp_session.should_receive(:file).with.and_return(@file_factory)
         | 
| 496 | 
            -
                  @file_factory.stub | 
| 500 | 
            +
                  @file_factory.stub(:open)
         | 
| 497 501 | 
             
                  @ssh_session.should_receive(:close)
         | 
| 498 502 | 
             
                  @ssh_session
         | 
| 499 503 | 
             
                end
         | 
    
        data/spec/ide/idea_spec.rb
    CHANGED
    
    | @@ -17,6 +17,14 @@ | |
| 17 17 | 
             
            require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helpers'))
         | 
| 18 18 | 
             
            require File.expand_path(File.join(File.dirname(__FILE__), '..', 'xpath_matchers'))
         | 
| 19 19 |  | 
| 20 | 
            +
            def ensure_facet_xpath(doc, type, name)
         | 
| 21 | 
            +
              facet_xpath = "/module/component[@name='FacetManager']/facet"
         | 
| 22 | 
            +
              doc.should have_xpath(facet_xpath)
         | 
| 23 | 
            +
              web_facet_xpath = "#{facet_xpath}[@type='#{type}', @name='#{name}']"
         | 
| 24 | 
            +
              doc.should have_xpath(web_facet_xpath)
         | 
| 25 | 
            +
              web_facet_xpath
         | 
| 26 | 
            +
            end
         | 
| 27 | 
            +
             | 
| 20 28 | 
             
            describe Buildr::IntellijIdea do
         | 
| 21 29 |  | 
| 22 30 | 
             
              def invoke_generate_task
         | 
| @@ -289,10 +297,517 @@ describe Buildr::IntellijIdea do | |
| 289 297 |  | 
| 290 298 | 
             
                  it "generates an IML for root project with a web and webservice facet" do
         | 
| 291 299 | 
             
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 292 | 
            -
                     | 
| 293 | 
            -
                    doc | 
| 294 | 
            -
             | 
| 295 | 
            -
             | 
| 300 | 
            +
                    ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 301 | 
            +
                    ensure_facet_xpath(doc, 'WebServicesClient', 'WebServices Client')
         | 
| 302 | 
            +
                  end
         | 
| 303 | 
            +
                end
         | 
| 304 | 
            +
             | 
| 305 | 
            +
                describe "using add_gwt_facet" do
         | 
| 306 | 
            +
                  before do
         | 
| 307 | 
            +
                    @foo = define "foo" do
         | 
| 308 | 
            +
                      iml.add_gwt_facet("com.biz.MyModule" => true, "com.biz.MyOtherModule" => false)
         | 
| 309 | 
            +
                    end
         | 
| 310 | 
            +
                    invoke_generate_task
         | 
| 311 | 
            +
                  end
         | 
| 312 | 
            +
             | 
| 313 | 
            +
                  it "generates a gwt facet with default settings" do
         | 
| 314 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 315 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
         | 
| 316 | 
            +
                    setting_xpath = "#{facet_xpath}/configuration/setting"
         | 
| 317 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='file://$GWT_TOOLS$']")
         | 
| 318 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtScriptOutputStyle', value='PRETTY']")
         | 
| 319 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='compilerParameters', value='-draftCompile -localWorkers 2 -strict']")
         | 
| 320 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='compilerParameters', value='-draftCompile -localWorkers 2 -strict']")
         | 
| 321 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='compilerMaxHeapSize', value='512']")
         | 
| 322 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='webFacet', value='Web']")
         | 
| 323 | 
            +
                  end
         | 
| 324 | 
            +
             | 
| 325 | 
            +
                  it "generates a gwt facet with specified modules" do
         | 
| 326 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 327 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
         | 
| 328 | 
            +
                    prefix = "#{facet_xpath}/configuration/packaging/module"
         | 
| 329 | 
            +
                    doc.should have_xpath("#{prefix}[@name='com.biz.MyModule', @enabled='true']")
         | 
| 330 | 
            +
                    doc.should have_xpath("#{prefix}[@name='com.biz.MyOtherModule', @enabled='false']")
         | 
| 331 | 
            +
                  end
         | 
| 332 | 
            +
                end
         | 
| 333 | 
            +
             | 
| 334 | 
            +
                describe "using add_gwt_facet that detects gwt sdk" do
         | 
| 335 | 
            +
                  before do
         | 
| 336 | 
            +
                    artifact('com.google.gwt:gwt-dev:jar:2.5.1-not-a-release') { |task| write task.name }
         | 
| 337 | 
            +
                    @foo = define "foo" do
         | 
| 338 | 
            +
                      compile.with 'com.google.gwt:gwt-dev:jar:2.5.1-not-a-release'
         | 
| 339 | 
            +
                      iml.add_gwt_facet("com.biz.MyModule" => true)
         | 
| 340 | 
            +
                    end
         | 
| 341 | 
            +
                    invoke_generate_task
         | 
| 342 | 
            +
                  end
         | 
| 343 | 
            +
             | 
| 344 | 
            +
                  it "generates a gwt facet with detected gwt sdk settings" do
         | 
| 345 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 346 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
         | 
| 347 | 
            +
                    setting_xpath = "#{facet_xpath}/configuration/setting"
         | 
| 348 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtSdkType', value='maven']")
         | 
| 349 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='$MAVEN_REPOSITORY$/com/google/gwt/gwt-dev/2.5.1-not-a-release']")
         | 
| 350 | 
            +
                  end
         | 
| 351 | 
            +
                end
         | 
| 352 | 
            +
             | 
| 353 | 
            +
                describe "using add_gwt_facet that specifies gwt sdk" do
         | 
| 354 | 
            +
                  before do
         | 
| 355 | 
            +
                    artifact('com.example:library:jar:2.0') { |task| write task.name }
         | 
| 356 | 
            +
                    @foo = define "foo" do
         | 
| 357 | 
            +
                      iml.add_gwt_facet({"com.biz.MyModule" => true},:gwt_dev_artifact => 'com.example:library:jar:2.0')
         | 
| 358 | 
            +
                    end
         | 
| 359 | 
            +
                    invoke_generate_task
         | 
| 360 | 
            +
                  end
         | 
| 361 | 
            +
             | 
| 362 | 
            +
                  it "generates a gwt facet with detected gwt sdk settings" do
         | 
| 363 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 364 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
         | 
| 365 | 
            +
                    setting_xpath = "#{facet_xpath}/configuration/setting"
         | 
| 366 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtSdkType', value='maven']")
         | 
| 367 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtSdkUrl', value='$MAVEN_REPOSITORY$/com/google/gwt/gwt-dev/2.5.1']")
         | 
| 368 | 
            +
                  end
         | 
| 369 | 
            +
                end
         | 
| 370 | 
            +
             | 
| 371 | 
            +
                describe "using add_gwt_facet that specifies settings" do
         | 
| 372 | 
            +
                  before do
         | 
| 373 | 
            +
                    @foo = define "foo" do
         | 
| 374 | 
            +
                      iml.add_gwt_facet({"com.biz.MyModule" => true, "com.biz.MyOtherModule" => false},
         | 
| 375 | 
            +
                                        :settings => {:gwtScriptOutputStyle => 'OTHER', :compilerMaxHeapSize => 1024, :zang => 'zang'})
         | 
| 376 | 
            +
                    end
         | 
| 377 | 
            +
                    invoke_generate_task
         | 
| 378 | 
            +
                  end
         | 
| 379 | 
            +
             | 
| 380 | 
            +
                  it "generates a gwt facet with specified settings" do
         | 
| 381 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 382 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'gwt', 'GWT')
         | 
| 383 | 
            +
                    setting_xpath = "#{facet_xpath}/configuration/setting"
         | 
| 384 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='zang', value='zang']")
         | 
| 385 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='gwtScriptOutputStyle', value='OTHER']")
         | 
| 386 | 
            +
                    doc.should have_xpath("#{setting_xpath}[@name='compilerMaxHeapSize', value='1024']")
         | 
| 387 | 
            +
                  end
         | 
| 388 | 
            +
                end
         | 
| 389 | 
            +
             | 
| 390 | 
            +
                describe "using add_web_facet with jsf and idea version 12" do
         | 
| 391 | 
            +
                  before do
         | 
| 392 | 
            +
                    write "src/main/webapp/WEB-INF/web.xml"
         | 
| 393 | 
            +
                    write "src/main/webapp/WEB-INF/faces-config.xml"
         | 
| 394 | 
            +
             | 
| 395 | 
            +
                    @foo = define "foo" do
         | 
| 396 | 
            +
                      ipr.version = "12"
         | 
| 397 | 
            +
                      iml.add_web_facet
         | 
| 398 | 
            +
                    end
         | 
| 399 | 
            +
                    invoke_generate_task
         | 
| 400 | 
            +
                  end
         | 
| 401 | 
            +
             | 
| 402 | 
            +
                  it "generates a web facet with jsf facet auto-detected" do
         | 
| 403 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 404 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 405 | 
            +
                    doc.should have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
         | 
| 406 | 
            +
                  end
         | 
| 407 | 
            +
                end
         | 
| 408 | 
            +
             | 
| 409 | 
            +
                describe "using add_web_facet with jsf and idea version 13" do
         | 
| 410 | 
            +
                  before do
         | 
| 411 | 
            +
                    write "src/main/webapp/WEB-INF/web.xml"
         | 
| 412 | 
            +
                    write "src/main/webapp/WEB-INF/faces-config.xml"
         | 
| 413 | 
            +
             | 
| 414 | 
            +
                    @foo = define "foo" do
         | 
| 415 | 
            +
                      ipr.version = "13"
         | 
| 416 | 
            +
                      iml.add_web_facet
         | 
| 417 | 
            +
                    end
         | 
| 418 | 
            +
                    invoke_generate_task
         | 
| 419 | 
            +
                  end
         | 
| 420 | 
            +
             | 
| 421 | 
            +
                  it "does not generate a web facet with jsf facet" do
         | 
| 422 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 423 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 424 | 
            +
                    doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
         | 
| 425 | 
            +
                  end
         | 
| 426 | 
            +
                end
         | 
| 427 | 
            +
             | 
| 428 | 
            +
                describe "using add_web_facet with jsf and idea version 13 and jsf 'enabled'" do
         | 
| 429 | 
            +
                  before do
         | 
| 430 | 
            +
                    write "src/main/webapp/WEB-INF/web.xml"
         | 
| 431 | 
            +
                    write "src/main/webapp/WEB-INF/faces-config.xml"
         | 
| 432 | 
            +
             | 
| 433 | 
            +
                    @foo = define "foo" do
         | 
| 434 | 
            +
                      ipr.version = "13"
         | 
| 435 | 
            +
                      iml.add_web_facet(:enable_jsf => true)
         | 
| 436 | 
            +
                    end
         | 
| 437 | 
            +
                    invoke_generate_task
         | 
| 438 | 
            +
                  end
         | 
| 439 | 
            +
             | 
| 440 | 
            +
                  it "does not generate a web facet with jsf facet" do
         | 
| 441 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 442 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 443 | 
            +
                    doc.should_not have_xpath("#{web_facet_xpath}/facet[@type='jsf', @name='JSF']")
         | 
| 444 | 
            +
                  end
         | 
| 445 | 
            +
                end
         | 
| 446 | 
            +
             | 
| 447 | 
            +
                describe "using add_web_facet" do
         | 
| 448 | 
            +
                  before do
         | 
| 449 | 
            +
                    write "src/main/webapp/WEB-INF/web.xml"
         | 
| 450 | 
            +
                    write "src/main/webapp/WEB-INF/glassfish-web.xml"
         | 
| 451 | 
            +
                    write "src/main/webapp/WEB-INF/context.xml"
         | 
| 452 | 
            +
             | 
| 453 | 
            +
                    @foo = define "foo" do
         | 
| 454 | 
            +
                      iml.add_web_facet
         | 
| 455 | 
            +
                    end
         | 
| 456 | 
            +
                    invoke_generate_task
         | 
| 457 | 
            +
                  end
         | 
| 458 | 
            +
             | 
| 459 | 
            +
                  it "generates a web facet with appropriate deployment descriptors" do
         | 
| 460 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 461 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 462 | 
            +
                    deployment_descriptor_xpath = "#{web_facet_xpath}/configuration/descriptors/deploymentDescriptor"
         | 
| 463 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='web.xml',  url='file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml']")
         | 
| 464 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='glassfish-web.xml',  url='file://$MODULE_DIR$/src/main/webapp/WEB-INF/glassfish-web.xml']")
         | 
| 465 | 
            +
                  end
         | 
| 466 | 
            +
             | 
| 467 | 
            +
                  it "generates a web facet with derived webroots" do
         | 
| 468 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 469 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 470 | 
            +
                    doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp', @realtive='/']")
         | 
| 471 | 
            +
                  end
         | 
| 472 | 
            +
                end
         | 
| 473 | 
            +
             | 
| 474 | 
            +
                describe "using add_web_facet with specified parameters" do
         | 
| 475 | 
            +
                  before do
         | 
| 476 | 
            +
                    @foo = define "foo" do
         | 
| 477 | 
            +
                      iml.add_web_facet(:deployment_descriptors => ["src/main/webapp2/WEB-INF/web.xml"],
         | 
| 478 | 
            +
                                        :webroots => {"src/main/webapp2" => "/", "src/main/css" => "/css"})
         | 
| 479 | 
            +
                    end
         | 
| 480 | 
            +
                    invoke_generate_task
         | 
| 481 | 
            +
                  end
         | 
| 482 | 
            +
             | 
| 483 | 
            +
                  it "generates a web facet with appropriate deployment descriptors" do
         | 
| 484 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 485 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 486 | 
            +
                    deployment_descriptor_xpath = "#{web_facet_xpath}/configuration/descriptors/deploymentDescriptor"
         | 
| 487 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='web.xml',  url='file://$MODULE_DIR$/src/main/webapp2/WEB-INF/web.xml']")
         | 
| 488 | 
            +
                  end
         | 
| 489 | 
            +
             | 
| 490 | 
            +
                  it "generates a web facet with specified webroots" do
         | 
| 491 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 492 | 
            +
                    web_facet_xpath = ensure_facet_xpath(doc, 'web', 'Web')
         | 
| 493 | 
            +
                    doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/webapp2', @realtive='/']")
         | 
| 494 | 
            +
                    doc.should have_xpath("#{web_facet_xpath}/configuration/webroots/root[@url='file://$MODULE_DIR$/src/main/css', @realtive='/css']")
         | 
| 495 | 
            +
                  end
         | 
| 496 | 
            +
                end
         | 
| 497 | 
            +
             | 
| 498 | 
            +
                describe "using add_jpa_facet" do
         | 
| 499 | 
            +
                  before do
         | 
| 500 | 
            +
                    write "src/main/resources/META-INF/persistence.xml", "org.hibernate.ejb.HibernatePersistence"
         | 
| 501 | 
            +
                    write "src/main/resources/META-INF/orm.xml"
         | 
| 502 | 
            +
             | 
| 503 | 
            +
                    @foo = define "foo" do
         | 
| 504 | 
            +
                      iml.add_jpa_facet
         | 
| 505 | 
            +
                    end
         | 
| 506 | 
            +
                    invoke_generate_task
         | 
| 507 | 
            +
                  end
         | 
| 508 | 
            +
             | 
| 509 | 
            +
                  it "generates a jpa facet with appropriate deployment descriptors" do
         | 
| 510 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 511 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 512 | 
            +
                    deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
         | 
| 513 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml',  url='file://$MODULE_DIR$/src/main/resources/META-INF/persistence.xml']")
         | 
| 514 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml',  url='file://$MODULE_DIR$/src/main/resources/META-INF/orm.xml']")
         | 
| 515 | 
            +
                  end
         | 
| 516 | 
            +
             | 
| 517 | 
            +
                  it "generates a jpa facet with default settings" do
         | 
| 518 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 519 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 520 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled', @value='true']")
         | 
| 521 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name', @value='Hibernate']")
         | 
| 522 | 
            +
                  end
         | 
| 523 | 
            +
                end
         | 
| 524 | 
            +
             | 
| 525 | 
            +
                describe "using add_jpa_facet specifying parameters" do
         | 
| 526 | 
            +
                  before do
         | 
| 527 | 
            +
                    write "src/main/resources2/META-INF/persistence.xml"
         | 
| 528 | 
            +
                    write "src/main/resources2/META-INF/orm.xml"
         | 
| 529 | 
            +
             | 
| 530 | 
            +
                    @foo = define "foo" do
         | 
| 531 | 
            +
                      iml.add_jpa_facet(:provider_enabled => 'Hibernate',
         | 
| 532 | 
            +
                                        :deployment_descriptors => ["src/main/resources2/META-INF/persistence.xml",
         | 
| 533 | 
            +
                                                                    "src/main/resources2/META-INF/orm.xml"])
         | 
| 534 | 
            +
                    end
         | 
| 535 | 
            +
                    invoke_generate_task
         | 
| 536 | 
            +
                  end
         | 
| 537 | 
            +
             | 
| 538 | 
            +
                  it "generates a jpa facet with appropriate deployment descriptors" do
         | 
| 539 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 540 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 541 | 
            +
                    deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
         | 
| 542 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml',  url='file://$MODULE_DIR$/src/main/resources2/META-INF/persistence.xml']")
         | 
| 543 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml',  url='file://$MODULE_DIR$/src/main/resources2/META-INF/orm.xml']")
         | 
| 544 | 
            +
                  end
         | 
| 545 | 
            +
             | 
| 546 | 
            +
                  it "generates a jpa facet with default settings" do
         | 
| 547 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 548 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 549 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled', @value='true']")
         | 
| 550 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name', @value='Hibernate']")
         | 
| 551 | 
            +
                  end
         | 
| 552 | 
            +
                end
         | 
| 553 | 
            +
             | 
| 554 | 
            +
                describe "using add_jpa_facet derived from main_source_directories" do
         | 
| 555 | 
            +
                  before do
         | 
| 556 | 
            +
                    write "src/main/resources2/META-INF/persistence.xml"
         | 
| 557 | 
            +
                    write "src/main/resources2/META-INF/orm.xml"
         | 
| 558 | 
            +
             | 
| 559 | 
            +
                    @foo = define "foo" do
         | 
| 560 | 
            +
                      iml.main_source_directories << "src/main/resources2"
         | 
| 561 | 
            +
                      iml.add_jpa_facet
         | 
| 562 | 
            +
             | 
| 563 | 
            +
                    end
         | 
| 564 | 
            +
                    invoke_generate_task
         | 
| 565 | 
            +
                  end
         | 
| 566 | 
            +
             | 
| 567 | 
            +
                  it "generates a jpa facet with appropriate deployment descriptors" do
         | 
| 568 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 569 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 570 | 
            +
                    deployment_descriptor_xpath = "#{facet_xpath}/configuration/deploymentDescriptor"
         | 
| 571 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='persistence.xml',  url='file://$MODULE_DIR$/src/main/resources2/META-INF/persistence.xml']")
         | 
| 572 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='orm.xml',  url='file://$MODULE_DIR$/src/main/resources2/META-INF/orm.xml']")
         | 
| 573 | 
            +
                  end
         | 
| 574 | 
            +
                end
         | 
| 575 | 
            +
             | 
| 576 | 
            +
                describe "using add_jpa_facet with hibernate configured in persistence.xml" do
         | 
| 577 | 
            +
                  before do
         | 
| 578 | 
            +
                    write "src/main/resources/META-INF/persistence.xml", "org.hibernate.ejb.HibernatePersistence"
         | 
| 579 | 
            +
                    write "src/main/resources/META-INF/orm.xml"
         | 
| 580 | 
            +
             | 
| 581 | 
            +
                    @foo = define "foo" do
         | 
| 582 | 
            +
                      iml.add_jpa_facet
         | 
| 583 | 
            +
                    end
         | 
| 584 | 
            +
                    invoke_generate_task
         | 
| 585 | 
            +
                  end
         | 
| 586 | 
            +
             | 
| 587 | 
            +
                  it "generates a jpa facet with default settings" do
         | 
| 588 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 589 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 590 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled', @value='true']")
         | 
| 591 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name', @value='Hibernate']")
         | 
| 592 | 
            +
                  end
         | 
| 593 | 
            +
                end
         | 
| 594 | 
            +
             | 
| 595 | 
            +
                describe "using add_jpa_facet with eclipselink configured in persistence.xml" do
         | 
| 596 | 
            +
                  before do
         | 
| 597 | 
            +
                    write "src/main/resources/META-INF/persistence.xml", "org.eclipse.persistence.jpa.PersistenceProvider"
         | 
| 598 | 
            +
                    write "src/main/resources/META-INF/orm.xml"
         | 
| 599 | 
            +
             | 
| 600 | 
            +
                    @foo = define "foo" do
         | 
| 601 | 
            +
                      iml.add_jpa_facet
         | 
| 602 | 
            +
                    end
         | 
| 603 | 
            +
                    invoke_generate_task
         | 
| 604 | 
            +
                  end
         | 
| 605 | 
            +
             | 
| 606 | 
            +
                  it "generates a jpa facet with default settings" do
         | 
| 607 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 608 | 
            +
                    facet_xpath = ensure_facet_xpath(doc, 'jpa', 'JPA')
         | 
| 609 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='validation-enabled', @value='true']")
         | 
| 610 | 
            +
                    doc.should have_xpath("#{facet_xpath}/configuration/setting[@name='provider-name', @value='EclipseLink']")
         | 
| 611 | 
            +
                  end
         | 
| 612 | 
            +
                end
         | 
| 613 | 
            +
             | 
| 614 | 
            +
                describe "using add_ejb_facet" do
         | 
| 615 | 
            +
                  before do
         | 
| 616 | 
            +
                    write "src/main/java/com/bin/foo.java"
         | 
| 617 | 
            +
                    write "src/main/resources/WEB-INF/ejb-jar.xml"
         | 
| 618 | 
            +
             | 
| 619 | 
            +
                    @foo = define "foo" do
         | 
| 620 | 
            +
                      iml.add_ejb_facet
         | 
| 621 | 
            +
                    end
         | 
| 622 | 
            +
                    invoke_generate_task
         | 
| 623 | 
            +
                  end
         | 
| 624 | 
            +
             | 
| 625 | 
            +
                  it "generates an ejb facet with appropriate deployment descriptors" do
         | 
| 626 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 627 | 
            +
                    ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
         | 
| 628 | 
            +
                    deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
         | 
| 629 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml',  url='file://$MODULE_DIR$/src/main/resources/WEB-INF/ejb-jar.xml']")
         | 
| 630 | 
            +
                  end
         | 
| 631 | 
            +
             | 
| 632 | 
            +
                  it "generates an ejb facet with derived ejbRoots" do
         | 
| 633 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 634 | 
            +
                    ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
         | 
| 635 | 
            +
                    doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/java']")
         | 
| 636 | 
            +
                    doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/src/main/resources']")
         | 
| 637 | 
            +
                  end
         | 
| 638 | 
            +
                end
         | 
| 639 | 
            +
             | 
| 640 | 
            +
                describe "using add_ejb_facet specifying parameters" do
         | 
| 641 | 
            +
                  before do
         | 
| 642 | 
            +
                    @foo = define "foo" do
         | 
| 643 | 
            +
                      iml.add_ejb_facet(:ejb_roots => ["generated/main/java","generated/main/resources"],
         | 
| 644 | 
            +
                      :deployment_descriptors => ["generated/main/resources/WEB-INF/ejb-jar.xml"])
         | 
| 645 | 
            +
                    end
         | 
| 646 | 
            +
                    invoke_generate_task
         | 
| 647 | 
            +
                  end
         | 
| 648 | 
            +
             | 
| 649 | 
            +
                  it "generates an ejb facet with appropriate deployment descriptors" do
         | 
| 650 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 651 | 
            +
                    ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
         | 
| 652 | 
            +
                    deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
         | 
| 653 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml',  url='file://$MODULE_DIR$/generated/main/resources/WEB-INF/ejb-jar.xml']")
         | 
| 654 | 
            +
                  end
         | 
| 655 | 
            +
             | 
| 656 | 
            +
                  it "generates an ejb facet with derived ejbRoots" do
         | 
| 657 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 658 | 
            +
                    ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
         | 
| 659 | 
            +
                    doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/java']")
         | 
| 660 | 
            +
                    doc.should have_xpath("#{ejb_facet_xpath}/configuration/ejbRoots/root[@url='file://$MODULE_DIR$/generated/main/resources']")
         | 
| 661 | 
            +
                  end
         | 
| 662 | 
            +
                end
         | 
| 663 | 
            +
             | 
| 664 | 
            +
                describe "using add_ejb_facet derived from main_source_directories" do
         | 
| 665 | 
            +
                  before do
         | 
| 666 | 
            +
                    write "src/main/resources2/WEB-INF/ejb-jar.xml"
         | 
| 667 | 
            +
                    @foo = define "foo" do
         | 
| 668 | 
            +
                      iml.main_source_directories << "src/main/resources2"
         | 
| 669 | 
            +
                      iml.add_ejb_facet
         | 
| 670 | 
            +
                    end
         | 
| 671 | 
            +
                    invoke_generate_task
         | 
| 672 | 
            +
                  end
         | 
| 673 | 
            +
             | 
| 674 | 
            +
                  it "generates an ejb facet with appropriate deployment descriptors" do
         | 
| 675 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 676 | 
            +
                    ejb_facet_xpath = ensure_facet_xpath(doc, 'ejb', 'EJB')
         | 
| 677 | 
            +
                    deployment_descriptor_xpath = "#{ejb_facet_xpath}/configuration/descriptors/deploymentDescriptor"
         | 
| 678 | 
            +
                    doc.should have_xpath("#{deployment_descriptor_xpath}[@name='ejb-jar.xml',  url='file://$MODULE_DIR$/src/main/resources2/WEB-INF/ejb-jar.xml']")
         | 
| 679 | 
            +
                  end
         | 
| 680 | 
            +
                end
         | 
| 681 | 
            +
             | 
| 682 | 
            +
                describe "using add_jruby_facet" do
         | 
| 683 | 
            +
                  before do
         | 
| 684 | 
            +
             | 
| 685 | 
            +
                    @foo = define "foo" do
         | 
| 686 | 
            +
                      iml.add_jruby_facet
         | 
| 687 | 
            +
                    end
         | 
| 688 | 
            +
                    invoke_generate_task
         | 
| 689 | 
            +
                  end
         | 
| 690 | 
            +
             | 
| 691 | 
            +
                  it "generates a jruby facet with appropriate sdk" do
         | 
| 692 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 693 | 
            +
                    jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
         | 
| 694 | 
            +
                    doc.should have_xpath("#{jruby_facet_xpath}/configuration/JRUBY_FACET_CONFIG_ID[@NAME='JRUBY_SDK_NAME', VALUE='jruby-1.6.7.2']")
         | 
| 695 | 
            +
                  end
         | 
| 696 | 
            +
             | 
| 697 | 
            +
                  it "generates a jruby facet with appropriate paths" do
         | 
| 698 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 699 | 
            +
                    jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
         | 
| 700 | 
            +
                    prefix = "#{jruby_facet_xpath}/configuration"
         | 
| 701 | 
            +
                    doc.should have_xpath("#{prefix}/LOAD_PATH[@number='0']")
         | 
| 702 | 
            +
                    doc.should have_xpath("#{prefix}/I18N_FOLDERS[@number='0']")
         | 
| 703 | 
            +
                  end
         | 
| 704 | 
            +
                end
         | 
| 705 | 
            +
             | 
| 706 | 
            +
                describe "using add_jruby_facet with .ruby-version specified" do
         | 
| 707 | 
            +
                  before do
         | 
| 708 | 
            +
             | 
| 709 | 
            +
                    write ".ruby-version", "jruby-1.7.2"
         | 
| 710 | 
            +
             | 
| 711 | 
            +
                    @foo = define "foo" do
         | 
| 712 | 
            +
                      iml.add_jruby_facet
         | 
| 713 | 
            +
                    end
         | 
| 714 | 
            +
                    invoke_generate_task
         | 
| 715 | 
            +
                  end
         | 
| 716 | 
            +
             | 
| 717 | 
            +
                  it "generates a jruby facet with appropriate sdk" do
         | 
| 718 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 719 | 
            +
                    jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
         | 
| 720 | 
            +
                    doc.should have_xpath("#{jruby_facet_xpath}/configuration/JRUBY_FACET_CONFIG_ID[@NAME='JRUBY_SDK_NAME', VALUE='rbenv: jruby-1.7.2']")
         | 
| 721 | 
            +
                  end
         | 
| 722 | 
            +
             | 
| 723 | 
            +
                  it "generates a jruby facet with appropriate paths" do
         | 
| 724 | 
            +
                    doc = xml_document(@foo._("foo.iml"))
         | 
| 725 | 
            +
                    jruby_facet_xpath = ensure_facet_xpath(doc, 'JRUBY', 'JRuby')
         | 
| 726 | 
            +
                    prefix = "#{jruby_facet_xpath}/configuration"
         | 
| 727 | 
            +
                    doc.should have_xpath("#{prefix}/LOAD_PATH[@number='0']")
         | 
| 728 | 
            +
                    doc.should have_xpath("#{prefix}/I18N_FOLDERS[@number='0']")
         | 
| 729 | 
            +
                  end
         | 
| 730 | 
            +
                end
         | 
| 731 | 
            +
             | 
| 732 | 
            +
                describe "with add_data_source" do
         | 
| 733 | 
            +
                  before do
         | 
| 734 | 
            +
                    artifact("org.postgresql:postgresql:jar:9.not-a-version") { |task| write task.name }
         | 
| 735 | 
            +
                    @foo = define "foo" do
         | 
| 736 | 
            +
                      ipr.add_data_source("Postgres",
         | 
| 737 | 
            +
                                          :driver => 'org.postgresql.Driver',
         | 
| 738 | 
            +
                                          :url => "jdbc:postgresql://127.0.0.1:5432/MyDb",
         | 
| 739 | 
            +
                                          :username => "MyDBUser",
         | 
| 740 | 
            +
                                          :password => "secreto",
         | 
| 741 | 
            +
                                          :dialect => "PostgreSQL",
         | 
| 742 | 
            +
                                          :classpath => ["org.postgresql:postgresql:jar:9.not-a-version"])
         | 
| 743 | 
            +
                    end
         | 
| 744 | 
            +
                    invoke_generate_task
         | 
| 745 | 
            +
                  end
         | 
| 746 | 
            +
             | 
| 747 | 
            +
                  it "generates a data source manager with specified data source" do
         | 
| 748 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 749 | 
            +
                    prefix_xpath = "/project/component[@name='DataSourceManagerImpl', @format='xml', @hash='3208837817']/data-source"
         | 
| 750 | 
            +
                    doc.should have_nodes(prefix_xpath, 1)
         | 
| 751 | 
            +
                    ds_path = "#{prefix_xpath}[@source='LOCAL', @name='Postgres']"
         | 
| 752 | 
            +
                    doc.should have_xpath(ds_path)
         | 
| 753 | 
            +
                    doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
         | 
| 754 | 
            +
                    doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'org.postgresql.Driver'")
         | 
| 755 | 
            +
                    doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:postgresql://127.0.0.1:5432/MyDb'")
         | 
| 756 | 
            +
                    doc.should have_xpath("#{ds_path}/user-name/text() = 'MyDBUser'")
         | 
| 757 | 
            +
                    doc.should have_xpath("#{ds_path}/user-password/text() = 'dfd9dfcfdfc9dfd8dfcfdfdedfc5'")
         | 
| 758 | 
            +
                    doc.should have_xpath("#{ds_path}/default-dialect/text() = 'PostgreSQL'")
         | 
| 759 | 
            +
                    doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.not-a-version/postgresql-9.not-a-version.jar'")
         | 
| 760 | 
            +
                  end
         | 
| 761 | 
            +
                end
         | 
| 762 | 
            +
             | 
| 763 | 
            +
                describe "with add_postgres_data_source" do
         | 
| 764 | 
            +
                  before do
         | 
| 765 | 
            +
                    ENV["USER"] = "Bob"
         | 
| 766 | 
            +
                    artifact("org.postgresql:postgresql:jar:9.2-1003-jdbc4") { |task| write task.name }
         | 
| 767 | 
            +
                    @foo = define "foo" do
         | 
| 768 | 
            +
                      ipr.add_postgres_data_source("Postgres", :database => 'MyDb')
         | 
| 769 | 
            +
                    end
         | 
| 770 | 
            +
                    invoke_generate_task
         | 
| 771 | 
            +
                  end
         | 
| 772 | 
            +
             | 
| 773 | 
            +
                  it "generates a data source manager with specified data source" do
         | 
| 774 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 775 | 
            +
                    prefix_xpath = "/project/component[@name='DataSourceManagerImpl', @format='xml', @hash='3208837817']/data-source"
         | 
| 776 | 
            +
                    doc.should have_nodes(prefix_xpath, 1)
         | 
| 777 | 
            +
                    ds_path = "#{prefix_xpath}[@source='LOCAL', @name='Postgres']"
         | 
| 778 | 
            +
                    doc.should have_xpath(ds_path)
         | 
| 779 | 
            +
                    doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
         | 
| 780 | 
            +
                    doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'org.postgresql.Driver'")
         | 
| 781 | 
            +
                    doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:postgresql://127.0.0.1:5432/MyDb'")
         | 
| 782 | 
            +
                    doc.should have_xpath("#{ds_path}/user-name/text() = 'Bob'")
         | 
| 783 | 
            +
                    doc.should have_xpath("#{ds_path}/default-dialect/text() = 'PostgreSQL'")
         | 
| 784 | 
            +
                    doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/org/postgresql/postgresql/9.2-1003-jdbc4/postgresql-9.2-1003-jdbc4.jar'")
         | 
| 785 | 
            +
                  end
         | 
| 786 | 
            +
                end
         | 
| 787 | 
            +
             | 
| 788 | 
            +
                describe "with add_sql_server_data_source" do
         | 
| 789 | 
            +
                  before do
         | 
| 790 | 
            +
                    ENV["USER"] = "Bob"
         | 
| 791 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7') { |task| write task.name }
         | 
| 792 | 
            +
                    @foo = define "foo" do
         | 
| 793 | 
            +
                      ipr.add_sql_server_data_source("SqlServer", :database => 'MyDb')
         | 
| 794 | 
            +
                    end
         | 
| 795 | 
            +
                    invoke_generate_task
         | 
| 796 | 
            +
                  end
         | 
| 797 | 
            +
             | 
| 798 | 
            +
                  it "generates a data source manager with specified data source" do
         | 
| 799 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 800 | 
            +
                    prefix_xpath = "/project/component[@name='DataSourceManagerImpl', @format='xml', @hash='3208837817']/data-source"
         | 
| 801 | 
            +
                    doc.should have_nodes(prefix_xpath, 1)
         | 
| 802 | 
            +
                    ds_path = "#{prefix_xpath}[@source='LOCAL', @name='SqlServer']"
         | 
| 803 | 
            +
                    doc.should have_xpath(ds_path)
         | 
| 804 | 
            +
             | 
| 805 | 
            +
                    doc.should have_xpath("#{ds_path}/synchronize/text() = 'true'")
         | 
| 806 | 
            +
                    doc.should have_xpath("#{ds_path}/jdbc-driver/text() = 'net.sourceforge.jtds.jdbc.Driver'")
         | 
| 807 | 
            +
                    doc.should have_xpath("#{ds_path}/jdbc-url/text() = 'jdbc:jtds:sqlserver://127.0.0.1:1433/MyDb'")
         | 
| 808 | 
            +
                    doc.should have_xpath("#{ds_path}/user-name/text() = 'Bob'")
         | 
| 809 | 
            +
                    doc.should have_xpath("#{ds_path}/default-dialect/text() = 'TSQL'")
         | 
| 810 | 
            +
                    doc.should have_xpath("#{ds_path}/libraries/library/url/text() = '$MAVEN_REPOSITORY$/net/sourceforge/jtds/1.2.7/jtds-1.2.7.jar'")
         | 
| 296 811 | 
             
                  end
         | 
| 297 812 | 
             
                end
         | 
| 298 813 |  | 
| @@ -320,6 +835,194 @@ describe Buildr::IntellijIdea do | |
| 320 835 | 
             
                  end
         | 
| 321 836 | 
             
                end
         | 
| 322 837 |  | 
| 838 | 
            +
                describe "that uses add_jar_artifact with no overrides" do
         | 
| 839 | 
            +
                  before do
         | 
| 840 | 
            +
                    write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
         | 
| 841 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
         | 
| 842 | 
            +
             | 
| 843 | 
            +
                    @foo = define "foo" do
         | 
| 844 | 
            +
                      project.version = '1.0'
         | 
| 845 | 
            +
                      define "bar" do
         | 
| 846 | 
            +
                        compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
         | 
| 847 | 
            +
                        package :war
         | 
| 848 | 
            +
                      end
         | 
| 849 | 
            +
                      ipr.add_jar_artifact(project("bar"))
         | 
| 850 | 
            +
                    end
         | 
| 851 | 
            +
                    invoke_generate_task
         | 
| 852 | 
            +
                  end
         | 
| 853 | 
            +
             | 
| 854 | 
            +
                  it "generates an IPR with a jar artifact" do
         | 
| 855 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 856 | 
            +
                    base_xpath = "/project/component[@name='ArtifactManager']/artifact"
         | 
| 857 | 
            +
                    facet_xpath = "#{base_xpath}[@type='jar' and @name='bar.jar' and @build-on-make='false']"
         | 
| 858 | 
            +
                    doc.should have_xpath(facet_xpath)
         | 
| 859 | 
            +
             | 
| 860 | 
            +
                    doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
         | 
| 861 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='module-output' and @name='bar']")
         | 
| 862 | 
            +
                  end
         | 
| 863 | 
            +
                end
         | 
| 864 | 
            +
             | 
| 865 | 
            +
                describe "that uses add_jar_artifact with overrides" do
         | 
| 866 | 
            +
                  before do
         | 
| 867 | 
            +
                    write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
         | 
| 868 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
         | 
| 869 | 
            +
             | 
| 870 | 
            +
                    @foo = define "foo" do
         | 
| 871 | 
            +
                      project.version = '1.0'
         | 
| 872 | 
            +
                      define "bar" do
         | 
| 873 | 
            +
                        compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
         | 
| 874 | 
            +
                        package :war
         | 
| 875 | 
            +
                      end
         | 
| 876 | 
            +
                      ipr.add_jar_artifact(project,
         | 
| 877 | 
            +
                                           :name => 'bar',
         | 
| 878 | 
            +
                                           :output_dir => _('bink'),
         | 
| 879 | 
            +
                                           :build_on_make => true,
         | 
| 880 | 
            +
                                           :ejb_module_names => ['x'],
         | 
| 881 | 
            +
                                           :jpa_module_names => ['p'],
         | 
| 882 | 
            +
                                           :dependencies => [project('bar')])
         | 
| 883 | 
            +
                    end
         | 
| 884 | 
            +
                    invoke_generate_task
         | 
| 885 | 
            +
                  end
         | 
| 886 | 
            +
             | 
| 887 | 
            +
                  it "generates an IPR with a jar artifact" do
         | 
| 888 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 889 | 
            +
                    base_xpath = "/project/component[@name='ArtifactManager']/artifact"
         | 
| 890 | 
            +
                    facet_xpath = "#{base_xpath}[@type='jar' and @name='bar.jar' and @build-on-make='true']"
         | 
| 891 | 
            +
                    doc.should have_xpath(facet_xpath)
         | 
| 892 | 
            +
             | 
| 893 | 
            +
                    doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/bink")
         | 
| 894 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='module-output' and @name='bar']")
         | 
| 895 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
         | 
| 896 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='archive' and @name='bar.jar']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
         | 
| 897 | 
            +
                  end
         | 
| 898 | 
            +
                end
         | 
| 899 | 
            +
             | 
| 900 | 
            +
                describe "that uses add_exploded_ejb_artifact with overrides" do
         | 
| 901 | 
            +
                  before do
         | 
| 902 | 
            +
                    write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
         | 
| 903 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
         | 
| 904 | 
            +
             | 
| 905 | 
            +
                    @foo = define "foo" do
         | 
| 906 | 
            +
                      project.version = '1.0'
         | 
| 907 | 
            +
                      define "bar" do
         | 
| 908 | 
            +
                        compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
         | 
| 909 | 
            +
                        package :jar
         | 
| 910 | 
            +
                      end
         | 
| 911 | 
            +
                      ipr.add_exploded_ejb_artifact(project("bar"),
         | 
| 912 | 
            +
                                                    :ejb_module_names => ['x'],
         | 
| 913 | 
            +
                                                    :jpa_module_names => ['p'])
         | 
| 914 | 
            +
                    end
         | 
| 915 | 
            +
                    invoke_generate_task
         | 
| 916 | 
            +
                  end
         | 
| 917 | 
            +
             | 
| 918 | 
            +
                  it "generates an IPR with an ejb artifact" do
         | 
| 919 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 920 | 
            +
                    base_xpath = "/project/component[@name='ArtifactManager']/artifact"
         | 
| 921 | 
            +
                    facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
         | 
| 922 | 
            +
                    doc.should have_xpath(facet_xpath)
         | 
| 923 | 
            +
                    doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
         | 
| 924 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
         | 
| 925 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='jpa-descriptors' and @facet='p/jpa/JPA']")
         | 
| 926 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/ejb/EJB']")
         | 
| 927 | 
            +
                  end
         | 
| 928 | 
            +
                end
         | 
| 929 | 
            +
             | 
| 930 | 
            +
                describe "that uses add_exploded_ejb_artifact with no overrides" do
         | 
| 931 | 
            +
                  before do
         | 
| 932 | 
            +
                    write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
         | 
| 933 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
         | 
| 934 | 
            +
             | 
| 935 | 
            +
                    @foo = define "foo" do
         | 
| 936 | 
            +
                      project.version = '1.0'
         | 
| 937 | 
            +
                      define "bar" do
         | 
| 938 | 
            +
                        compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
         | 
| 939 | 
            +
                        package :war
         | 
| 940 | 
            +
                      end
         | 
| 941 | 
            +
                      ipr.add_exploded_ejb_artifact(project("bar"))
         | 
| 942 | 
            +
                    end
         | 
| 943 | 
            +
                    invoke_generate_task
         | 
| 944 | 
            +
                  end
         | 
| 945 | 
            +
             | 
| 946 | 
            +
                  it "generates an IPR with an ejb artifact" do
         | 
| 947 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 948 | 
            +
                    base_xpath = "/project/component[@name='ArtifactManager']/artifact"
         | 
| 949 | 
            +
                    facet_xpath = "#{base_xpath}[@type='exploded-ejb' and @name='bar' and @build-on-make='false']"
         | 
| 950 | 
            +
                    doc.should have_xpath(facet_xpath)
         | 
| 951 | 
            +
             | 
| 952 | 
            +
                    doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
         | 
| 953 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='module-output' and @name='bar']")
         | 
| 954 | 
            +
                  end
         | 
| 955 | 
            +
                end
         | 
| 956 | 
            +
             | 
| 957 | 
            +
             | 
| 958 | 
            +
                describe "that uses add_exploded_war_artifact with no overrides" do
         | 
| 959 | 
            +
                  before do
         | 
| 960 | 
            +
                    write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
         | 
| 961 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
         | 
| 962 | 
            +
             | 
| 963 | 
            +
                    @foo = define "foo" do
         | 
| 964 | 
            +
                      project.version = '1.0'
         | 
| 965 | 
            +
                      define "bar" do
         | 
| 966 | 
            +
                        compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
         | 
| 967 | 
            +
                        package :war
         | 
| 968 | 
            +
                      end
         | 
| 969 | 
            +
                      ipr.add_exploded_war_artifact(project("bar"))
         | 
| 970 | 
            +
                    end
         | 
| 971 | 
            +
                    invoke_generate_task
         | 
| 972 | 
            +
                  end
         | 
| 973 | 
            +
             | 
| 974 | 
            +
                  it "generates an IPR with a war artifact" do
         | 
| 975 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 976 | 
            +
                    base_xpath = "/project/component[@name='ArtifactManager']/artifact"
         | 
| 977 | 
            +
                    facet_xpath = "#{base_xpath}[@type='exploded-war' and @name='bar' and @build-on-make='false']"
         | 
| 978 | 
            +
                    doc.should have_xpath(facet_xpath)
         | 
| 979 | 
            +
             | 
| 980 | 
            +
                    doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/bar")
         | 
| 981 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory', @name='classes']/element[@id='module-output' and @name='bar']")
         | 
| 982 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory', @name='lib']/element[@id='file-copy' and @path='$MAVEN_REPOSITORY$/net/sourceforge/jtds/jtds/1.2.7.XX/jtds-1.2.7.XX.jar']")
         | 
| 983 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='bar/web/Web']")
         | 
| 984 | 
            +
                  end
         | 
| 985 | 
            +
                end
         | 
| 986 | 
            +
             | 
| 987 | 
            +
                describe "that uses add_exploded_war_artifact with overrides" do
         | 
| 988 | 
            +
                  before do
         | 
| 989 | 
            +
                    write 'foo/bar/src/main/java/foo/Foo.java' # needed so that buildr will treat as a java project
         | 
| 990 | 
            +
                    artifact('net.sourceforge.jtds:jtds:jar:1.2.7.XX') { |task| write task.name }
         | 
| 991 | 
            +
             | 
| 992 | 
            +
                    @foo = define "foo" do
         | 
| 993 | 
            +
                      project.version = '1.0'
         | 
| 994 | 
            +
                      define "bar" do
         | 
| 995 | 
            +
                        compile.with 'net.sourceforge.jtds:jtds:jar:1.2.7.XX'
         | 
| 996 | 
            +
                        package :war
         | 
| 997 | 
            +
                      end
         | 
| 998 | 
            +
                      ipr.add_exploded_war_artifact(project,
         | 
| 999 | 
            +
                                                    :name => 'gar',
         | 
| 1000 | 
            +
                                                    :war_module_names => ['x','y'],
         | 
| 1001 | 
            +
                                                    :gwt_module_names => ['p','q'],
         | 
| 1002 | 
            +
                                                    :artifacts => ['baz','biz'],
         | 
| 1003 | 
            +
                                                    :dependencies => ['net.sourceforge.jtds:jtds:jar:1.2.7.XX', project('bar')])
         | 
| 1004 | 
            +
                    end
         | 
| 1005 | 
            +
                    invoke_generate_task
         | 
| 1006 | 
            +
                  end
         | 
| 1007 | 
            +
             | 
| 1008 | 
            +
                  it "generates an IPR with a war artifact" do
         | 
| 1009 | 
            +
                    doc = xml_document(@foo._("foo.ipr"))
         | 
| 1010 | 
            +
                    base_xpath = "/project/component[@name='ArtifactManager']/artifact"
         | 
| 1011 | 
            +
                    facet_xpath = "#{base_xpath}[@type='exploded-war' @name='MyFancy.jar', @build-on-make='false']"
         | 
| 1012 | 
            +
                    doc.should have_xpath(facet_xpath)
         | 
| 1013 | 
            +
             | 
| 1014 | 
            +
                    doc.should have_xpath("#{facet_xpath}/output-path/text() = $PROJECT_DIR$/artifacts/gar")
         | 
| 1015 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory', @name='classes']/element[@id='module-output' and @name='bar']")
         | 
| 1016 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory', @name='lib']/element[@id='file-copy' and @path='$MAVEN_REPOSITORY$/net/sourceforge/jtds/jtds/1.2.7.XX/jtds-1.2.7.XX.jar']")
         | 
| 1017 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='x/web/Web']")
         | 
| 1018 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='javaee-facet-resources' and @facet='y/web/Web']")
         | 
| 1019 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='gwt-compiler-output' and @facet='p/gwt/GWT']")
         | 
| 1020 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='gwt-compiler-output' and @facet='q/gwt/GWT']")
         | 
| 1021 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory', @name='lib']/element[@id='artifact' and @artifact-name='baz.jar']")
         | 
| 1022 | 
            +
                    doc.should have_xpath("#{facet_xpath}/root[@id='root']/element[@id='directory' and @name='WEB-INF']/element[@id='directory', @name='lib']/element[@id='artifact' and @artifact-name='biz.jar']")
         | 
| 1023 | 
            +
                  end
         | 
| 1024 | 
            +
                end
         | 
| 1025 | 
            +
             | 
| 323 1026 | 
             
                describe "with configurations added to root project" do
         | 
| 324 1027 | 
             
                  before do
         | 
| 325 1028 | 
             
                    @foo = define "foo" do
         |