<commit_before><?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
			http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">

    <context:annotation-config/>

    <!-- DATABASE SETUP -->
    <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="username" value="parking"/>
        <property name="password" value="<PASSWORD>"/>
        <property name="url" value="jdbc:postgresql://127.0.0.1:5432/parking"/>
        <property name="driverClassName" value="org.postgresql.Driver"/>
    </bean>

    <bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="persistenceUnitName" value="examplePU"/>
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="generateDdl" value="false"/>
                <property name="showSql" value="true"/>
            </bean>
        </property>
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
            </props>
        </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>

    <bean id="postDao" class="com.parking.dao.post.JpaPostDao"/>
    <bean id="userDao" class="com.parking.dao.account.JpaAccountDao"/>
    <bean id="vehicleDao" class="com.parking.dao.vehicle.JpaVehicleDao"/>
    <bean id="parkingDao" class="com.parking.dao.parking.JpaParkingDao"/>
    <bean id="connectionDao" class="com.parking.dao.connection.JpaConnectionDao"/>
    <bean id="accountGroupDao" class="com.parking.dao.accountGroup.JpaUserGroupDao"/>

    <bean id="dataBaseInitializer" class="com.parking.dao.DataBaseInitializer" init-method="initDataBase">
        <constructor-arg ref="userDao"/>
        <constructor-arg ref="postDao"/>
        <constructor-arg ref="passwordEncoder"/>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <!--
        INIT REST COMPONENTS
     -->

    <context:component-scan base-package="com.parking.rest.resources"/>

    <context:component-scan base-package="com.parking.services.impl"/>


    <bean id="objectMapper" class="org.codehaus.jackson.map.ObjectMapper"/>

    <!--
        SPRING SECURITY SETUP
    -->

    <bean id="passwordEncoder" class="org.springframework.security.crypto.password.StandardPasswordEncoder">
        <constructor-arg value="ThisIsASecretSoChangeMe"/>
    </bean>

    <security:authentication-manager id="authenticationManager">
        <security:authentication-provider user-service-ref="userDao">
            <security:password-encoder ref="passwordEncoder"></security:password-encoder>
        </security:authentication-provider>
    </security:authentication-manager>

    <security:http
            realm="Protected API"
            use-expressions="true"
            auto-config="false"
            create-session="stateless"
            entry-point-ref="unauthorizedEntryPoint"
            authentication-manager-ref="authenticationManager">
        <security:custom-filter ref="authenticationTokenProcessingFilter" position="FORM_LOGIN_FILTER"/>
        <security:intercept-url pattern="/rest/user/authenticate" access="permitAll"/>
        <security:intercept-url method="GET" pattern="/rest/news/**" access="hasRole('user')"/>
        <security:intercept-url method="PUT" pattern="/rest/news/**" access="hasRole('admin')"/>
        <security:intercept-url method="POST" pattern="/rest/news/**" access="hasRole('admin')"/>
        <security:intercept-url method="DELETE" pattern="/rest/news/**" access="hasRole('admin')"/>
    </security:http>

    <bean id="unauthorizedEntryPoint"
          class="com.parking.rest.UnauthorizedEntryPoint"/>

    <bean class="com.parking.rest.AuthenticationTokenProcessingFilter"
          id="authenticationTokenProcessingFilter">
        <constructor-arg ref="userDao"/>
    </bean>

</beans><commit_msg>added jersey test framework<commit_after><?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:security="http://www.springframework.org/schema/security"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
			http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
			http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
			http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd">

    <context:annotation-config/>

    <!-- DATABASE SETUP -->
    <bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource">
        <property name="username" value="parking"/>
        <property name="password" value="<PASSWORD>"/>
        <property name="url" value="jdbc:postgresql://127.0.0.1:5432/parking"/>
        <property name="driverClassName" value="org.postgresql.Driver"/>
    </bean>

    <bean id="entityManagerFactory"
          class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource"/>
        <property name="persistenceUnitName" value="examplePU"/>
        <property name="jpaVendorAdapter">
            <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
                <property name="generateDdl" value="false"/>
                <property name="showSql" value="true"/>
            </bean>
        </property>
        <property name="jpaProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
            </props>
        </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory"/>
    </bean>

    <bean id="postDao" class="com.parking.dao.post.JpaPostDao"/>
    <bean id="userDao" class="com.parking.dao.account.JpaAccountDao"/>
    <bean id="vehicleDao" class="com.parking.dao.vehicle.JpaVehicleDao"/>
    <bean id="parkingDao" class="com.parking.dao.parking.JpaParkingDao"/>
    <bean id="connectionDao" class="com.parking.dao.connection.JpaConnectionDao"/>
    <bean id="accountGroupDao" class="com.parking.dao.accountGroup.JpaUserGroupDao"/>

    <bean id="dataBaseInitializer" class="com.parking.dao.DataBaseInitializer" init-method="initDataBase">
        <constructor-arg ref="userDao"/>
        <constructor-arg ref="postDao"/>
        <constructor-arg ref="passwordEncoder"/>
    </bean>

    <tx:annotation-driven transaction-manager="transactionManager"/>

    <!--
        INIT REST COMPONENTS
     -->

    <context:component-scan base-package="com.parking.rest.resources"/>

    <context:component-scan base-package="com.parking.services.impl"/>


    <bean id="objectMapper" class="org.codehaus.jackson.map.ObjectMapper"/>

    <!--
        SPRING SECURITY SETUP
    -->

    <bean id="passwordEncoder" class="org.springframework.security.crypto.password.StandardPasswordEncoder">
        <constructor-arg value="ThisIsASecretSoChangeMe"/>
    </bean>

    <security:authentication-manager id="authenticationManager">
        <security:authentication-provider user-service-ref="userDao">
            <security:password-encoder ref="passwordEncoder"></security:password-encoder>
        </security:authentication-provider>
    </security:authentication-manager>

    <security:http
            realm="Protected API"
            use-expressions="true"
            auto-config="false"
            create-session="stateless"
            entry-point-ref="unauthorizedEntryPoint"
            authentication-manager-ref="authenticationManager">
        <security:custom-filter ref="authenticationTokenProcessingFilter" position="FORM_LOGIN_FILTER"/>
        <security:intercept-url pattern="/rest/user/authenticate" access="permitAll"/>
        <security:intercept-url method="GET" pattern="/rest/post/**" access="hasRole('user')"/>
        <security:intercept-url method="PUT" pattern="/rest/post/**" access="hasRole('admin')"/>
        <security:intercept-url method="POST" pattern="/rest/post/**" access="hasRole('admin')"/>
        <security:intercept-url method="DELETE" pattern="/rest/post/**" access="hasRole('admin')"/>
    </security:http>

    <bean id="unauthorizedEntryPoint"
          class="com.parking.rest.UnauthorizedEntryPoint"/>

    <bean class="com.parking.rest.AuthenticationTokenProcessingFilter"
          id="authenticationTokenProcessingFilter">
        <constructor-arg ref="userDao"/>
    </bean>

</beans>
{'fraction_non_alphanumeric': 0.15645292207792208, 'fraction_numerical': 0.005681818181818182, 'mean_word_length': 3.5718923933209648, 'pattern_counts': {'":': 0, '<': 141, '<?xml version=': 2, '>': 141, 'https://': 0, 'lorem ipsum': 0, 'www.': 26, 'xml': 12}, 'pii_count': 2, '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': '4488123', 'n_tokens_mistral': 2874, 'n_tokens_neox': 2822, 'n_words': 344}