<commit_before>/**

   Copyright 2010 OpenEngSB Division, Vienna University of Technology

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   
 */

package org.openengsb.edb.core.test.unit.repository;

import static org.junit.Assert.assertEquals;

import java.io.File;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.openengsb.edb.core.api.EDBHandlerFactory;
import org.openengsb.edb.core.entities.GenericContent;
import org.openengsb.edb.core.repository.Repository;
import org.openengsb.edb.core.repository.RepositoryFactory;
import org.openengsb.edb.core.repository.jgit.GitRepositoryFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Tests to check if the repository wrapper works correctly.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:testBeans.xml" })
public class GitRepositoryTest {

    @Resource
    private EDBHandlerFactory factory;

    @Test
    public void testGitCommit() throws Exception {
        RepositoryFactory factory = new GitRepositoryFactory();
        Repository repo = factory.loadRepository("target/testRepo");

        GenericContent content = new GenericContent("target/testRepo", new String[] { "path1", "path2", "path3", },
                new String[] { "a", "b", "c", });
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitA").commit();
        content.setProperty("first", "first");
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitB").commit();
        content.setProperty("second", "second");
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitC").commit();
        content.setProperty("third", "third");
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitD").commit();

        repo.removeRepository();
    }

    @Test
    public void testRemoveRepository() throws Exception {
        RepositoryFactory factory = new GitRepositoryFactory();
        Repository repo = factory.loadRepository("target/testDeleteRepo");
        assertEquals(true, new File("target/testDeleteRepo").exists());
        repo.removeRepository();
        assertEquals(false, new File("target/testDeleteRepo").exists());
    }

}<commit_msg>replaced assertEquals with assertFalse<commit_after>/**

   Copyright 2010 OpenEngSB Division, Vienna University of Technology

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   
 */

package org.openengsb.edb.core.test.unit.repository;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import java.io.File;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.openengsb.edb.core.api.EDBHandlerFactory;
import org.openengsb.edb.core.entities.GenericContent;
import org.openengsb.edb.core.repository.Repository;
import org.openengsb.edb.core.repository.RepositoryFactory;
import org.openengsb.edb.core.repository.jgit.GitRepositoryFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Tests to check if the repository wrapper works correctly.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:testBeans.xml" })
public class GitRepositoryTest {

    @Resource
    private EDBHandlerFactory factory;

    @Test
    public void testGitCommit() throws Exception {
        RepositoryFactory factory = new GitRepositoryFactory();
        Repository repo = factory.loadRepository("target/testRepo");

        GenericContent content = new GenericContent("target/testRepo", new String[] { "path1", "path2", "path3", },
                new String[] { "a", "b", "c", });
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitA").commit();
        content.setProperty("first", "first");
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitB").commit();
        content.setProperty("second", "second");
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitC").commit();
        content.setProperty("third", "third");
        content.store();

        repo.prepareCommit().add(content).setAuthor("<NAME>", "<EMAIL>").setMessage("CommitD").commit();

        repo.removeRepository();
    }

    @Test
    public void testRemoveRepository() throws Exception {
        RepositoryFactory factory = new GitRepositoryFactory();
        Repository repo = factory.loadRepository("target/testDeleteRepo");
        assertEquals(true, new File("target/testDeleteRepo").exists());
        repo.removeRepository();
        assertFalse(new File("target/testDeleteRepo").exists());
    }

}
{'fraction_non_alphanumeric': 0.12387497954508264, 'fraction_numerical': 0.004581901489117984, 'mean_word_length': 4.063794531897266, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '3756461', 'n_tokens_mistral': 1634, 'n_tokens_neox': 1615, 'n_words': 403}