<commit_before>import os
import unittest

import boto3

from gordon.utils_tests import BaseIntegrationTest, BaseBuildTest
from gordon.utils import valid_cloudformation_name
from gordon import utils


@unittest.skipIf(os.environ.get('TRAVIS'), "Test not yet supported on travis")
class IntegrationTest(BaseIntegrationTest):

    def test_0001_project(self):
        self._test_project_step('0001_project')
        self.assert_stack_succeed('p')
        self.assert_stack_succeed('r')

        lambda_ = self.get_lambda(utils.valid_cloudformation_name('javaexample:javaexample'))
        self.assertEqual(lambda_['Runtime'], 'java8')
        self.assertEqual(lambda_['Description'], 'My description')
        self.assertEqual(lambda_['MemorySize'], 192)
        self.assertEqual(lambda_['Timeout'], 123)

        aliases = self.get_lambda_aliases(function_name=lambda_['FunctionName'])
        self.assertEqual(aliases.keys(), ['current'])

        response = self.invoke_lambda(
            function_name=lambda_['FunctionName'],
            payload={'key1': 'hello'}
        )
        self.assert_lambda_response(response, 'hello')


@unittest.skipIf(os.environ.get('TRAVIS'), "Test not yet supported on travis")
class BuildTest(BaseBuildTest):

    def test_0001_project(self):
        self._test_project_step('0001_project')
        self.assertBuild('0001_project', '0001_p.json')
        self.assertBuild('0001_project', '0002_pr_r.json')
        self.assertBuild('0001_project', '0003_r.json')

        self.assertRun(
            '0001_project',
            'javaexample.javaexample',
            '{"key1":"value1", "key2":"value2", "key3":"value3"}',
            ['Loading function',
            'value1 = value1',
            'output: value1',
            '']
        )<commit_msg>Fix java tests<commit_after>import os
import unittest

import boto3

from gordon.utils_tests import BaseIntegrationTest, BaseBuildTest
from gordon.utils import valid_cloudformation_name
from gordon import utils


@unittest.skipIf(os.environ.get('TRAVIS') == 'true', "Test not yet supported on travis")
class IntegrationTest(BaseIntegrationTest):

    def test_0001_project(self):
        self._test_project_step('0001_project')
        self.assert_stack_succeed('p')
        self.assert_stack_succeed('r')

        lambda_ = self.get_lambda(utils.valid_cloudformation_name('javaexample:javaexample'))
        self.assertEqual(lambda_['Runtime'], 'java8')
        self.assertEqual(lambda_['Description'], 'My description')
        self.assertEqual(lambda_['MemorySize'], 192)
        self.assertEqual(lambda_['Timeout'], 123)

        aliases = self.get_lambda_aliases(function_name=lambda_['FunctionName'])
        self.assertEqual(aliases.keys(), ['current'])

        response = self.invoke_lambda(
            function_name=lambda_['FunctionName'],
            payload={'key1': 'hello'}
        )
        self.assert_lambda_response(response, 'hello')


@unittest.skipIf(os.environ.get('TRAVIS') == 'true', "Test not yet supported on travis")
class BuildTest(BaseBuildTest):

    def test_0001_project(self):
        self._test_project_step('0001_project')
        self.assertBuild('0001_project', '0001_p.json')
        self.assertBuild('0001_project', '0002_pr_r.json')
        self.assertBuild('0001_project', '0003_r.json')

        self.assertRun(
            '0001_project',
            'javaexample.javaexample',
            '{"key1":"value1", "key2":"value2", "key3":"value3"}',
            ['Loading function',
            'value1 = value1',
            'output: value1',
            '']
        )
{'fraction_non_alphanumeric': 0.1289963858771198, 'fraction_numerical': 0.03447317208785099, 'mean_word_length': 3.436498150431566, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1277584', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1043, 'n_words': 174}