<commit_before>package com.ohmdb.statistical;

/*
 * #%L
 * ohmdb-test
 * %%
 * Copyright (C) 2013 - 2014 <NAME>
 * %%
 * 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.
 * #L%
 */

import org.testng.annotations.Test;

import com.ohmdb.test.Book;
import com.ohmdb.test.DatabaseCheck;
import com.ohmdb.test.Person;
import com.ohmdb.test.RelationShadow;
import com.ohmdb.test.TableShadow;
import com.ohmdb.test.TestCommons;

public class StatisticalTest extends TestCommons {

	protected static final int MINI_REL_COUNT = 20;

	@Test(dataProvider = "num10")
	public void randomTableAndRelationOps(int scale) {
		final int factor = scale + 1; // [1..11]

		final int total = 1000;

		final int threadsFactor = factor; // 1, 2, 3...
		final int refreshMs = 20 * factor + 5; // 5, 25, 55...

		final DatabaseCheck db = new DatabaseCheck(refreshMs, threadsFactor);

		db.register(new TableChecker<Person>("insert person", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				table.insert(new Person(rndStr(100), rnd()));
			}
		});

		db.register(new TableChecker<Person>("delete person", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				int id = rnd(iteration);
				table.delete(id);
			}
		});

		db.register(new TableChecker<Person>("set person name", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				table.set(rnd(total * factor), "name", rndStr(100));
			}
		});

		db.register(new TableChecker<Person>("set person age", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				table.set(rnd(total * factor), "age", rnd());
			}<commit_msg>Increased concurency factor of statistical test.<commit_after>package com.ohmdb.statistical;

/*
 * #%L
 * ohmdb-test
 * %%
 * Copyright (C) 2013 - 2014 <NAME>
 * %%
 * 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.
 * #L%
 */

import org.testng.annotations.Test;

import com.ohmdb.test.Book;
import com.ohmdb.test.DatabaseCheck;
import com.ohmdb.test.Person;
import com.ohmdb.test.RelationShadow;
import com.ohmdb.test.TableShadow;
import com.ohmdb.test.TestCommons;

public class StatisticalTest extends TestCommons {

	protected static final int MINI_REL_COUNT = 20;

	@Test(dataProvider = "num10")
	public void randomTableAndRelationOps(int scale) {
		final int factor = scale + 1; // [1..11]

		final int total = 100;

		final int threadsFactor = factor * 10; // 1, 2, 3...
		final int refreshMs = 200 * factor + 5; // 5, 25, 55...

		final DatabaseCheck db = new DatabaseCheck(refreshMs, threadsFactor);

		db.register(new TableChecker<Person>("insert person", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				table.insert(new Person(rndStr(100), rnd()));
			}
		});

		db.register(new TableChecker<Person>("delete person", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				int id = rnd(iteration);
				table.delete(id);
			}
		});

		db.register(new TableChecker<Person>("set person name", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				table.set(rnd(total * factor), "name", rndStr(100));
			}
		});

		db.register(new TableChecker<Person>("set person age", Person.class) {
			@Override
			public void check(TableShadow<Person> table, int iteration) {
				table.set(rnd(total * factor), "age", rnd());
			}
{'fraction_non_alphanumeric': 0.12088888888888889, 'fraction_numerical': 0.018666666666666668, 'mean_word_length': 3.9299014238773275, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5563861', 'n_tokens_mistral': 1560, 'n_tokens_neox': 1371, 'n_words': 430}