<commit_before>require 'spec_helper.rb'

describe 'jira' do
  describe 'jira::config' do
    context 'supported operating systems' do
      on_supported_os.each do |os, facts|
        context "on #{os}" do
          let(:facts) do
            facts
          end

          context 'default params' do
            let(:params) do
              {
                version: '6.3.4a',
                javahome: '/opt/java'
              }
            end

            it { is_expected.to compile.with_all_deps }
            it do
              is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh').
                with_content(%r{#DISABLE_NOTIFICATIONS=})
            end
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') }
            it do
              is_expected.to contain_file('/home/jira/dbconfig.xml').
                with_content(%r{jdbc:postgresql://localhost:5432/jira}).
                with_content(%r{<schema-name>public</schema-name>})
            end
            it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
            it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/check-java.sh') }
          end

          context 'mysql params' do
            let(:params) do
              {
                version: '6.3.4a',
                javahome: '/opt/java',
                db: 'mysql'
              }
            end

            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') }
            it do
              is_expected.to contain_file('/home/jira/dbconfig.xml').
                with_content(%r{jdbc:mysql://localhost:5432/jira})
            end
          end

          context 'sqlserver params' do
            let(:params) do
              {
                version: '6.3.4a',
                javahome: '/opt/java',
                db: 'sqlserver',
                dbport: '1433',
                dbschema: 'public'
              }
            end

            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') }
            it do
              is_expected.to contain_file('/home/jira/dbconfig.xml').
                with_content(%r{<schema-name>public</schema-name>})
            end
          end<commit_msg>Fix #73 MySQL test default port should be 3306<commit_after>require 'spec_helper.rb'

describe 'jira' do
  describe 'jira::config' do
    context 'supported operating systems' do
      on_supported_os.each do |os, facts|
        context "on #{os}" do
          let(:facts) do
            facts
          end

          context 'default params' do
            let(:params) do
              {
                version: '6.3.4a',
                javahome: '/opt/java'
              }
            end

            it { is_expected.to compile.with_all_deps }
            it do
              is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh').
                with_content(%r{#DISABLE_NOTIFICATIONS=})
            end
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') }
            it do
              is_expected.to contain_file('/home/jira/dbconfig.xml').
                with_content(%r{jdbc:postgresql://localhost:5432/jira}).
                with_content(%r{<schema-name>public</schema-name>})
            end
            it { is_expected.not_to contain_file('/home/jira/cluster.properties') }
            it { is_expected.not_to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/check-java.sh') }
          end

          context 'mysql params' do
            let(:params) do
              {
                version: '6.3.4a',
                javahome: '/opt/java',
                db: 'mysql'
              }
            end

            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') }
            it do
              is_expected.to contain_file('/home/jira/dbconfig.xml').
                with_content(%r{jdbc:mysql://localhost:3306/jira})
            end
          end

          context 'sqlserver params' do
            let(:params) do
              {
                version: '6.3.4a',
                javahome: '/opt/java',
                db: 'sqlserver',
                dbport: '1433',
                dbschema: 'public'
              }
            end

            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/setenv.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/bin/user.sh') }
            it { is_expected.to contain_file('/opt/jira/atlassian-jira-6.3.4a-standalone/conf/server.xml') }
            it do
              is_expected.to contain_file('/home/jira/dbconfig.xml').
                with_content(%r{<schema-name>public</schema-name>})
            end
          end
{'fraction_non_alphanumeric': 0.1284419360355738, 'fraction_numerical': 0.018471010774756286, 'mean_word_length': 1.5841802916482546, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '906457', 'n_tokens_mistral': 1926, 'n_tokens_neox': 1852, 'n_words': 261}