/**
 * Copyright 2014-2016 Emmanuel Keller / QWAZR
 * <p>
 * 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
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * 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 com.qwazr.library.test;

import com.qwazr.classloader.ClassLoaderManager;
import com.qwazr.database.TableManager;
import com.qwazr.database.TableServiceInterface;
import com.qwazr.library.LibraryManager;
import com.qwazr.utils.FileUtils;
import org.junit.Before;
import org.junit.BeforeClass;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;

public abstract class AbstractLibraryTest {

	private static LibraryManager libraryManager;

	@BeforeClass
	public static void init() throws IOException {
		final Path dataDirectory = Files.createTempDirectory("library-test");
		final Collection<File> etcFiles = Arrays.asList(new File("src/test/resources/etc/library.json"));
		final ClassLoaderManager classLoaderManager =
				new ClassLoaderManager(dataDirectory.toFile(), Thread.currentThread());
		final TableManager tableManager = new TableManager(dataDirectory.resolve(TableServiceInterface.SERVICE_NAME));
		libraryManager =
				new LibraryManager(classLoaderManager, tableManager.getService(), dataDirectory.toFile(), etcFiles);

		final File resourcesDirectory = new File("src/test/resources");
		if (resourcesDirectory.exists())
			FileUtils.copyDirectory(resourcesDirectory, dataDirectory.toFile());
	}

	@Before
	public void inject() {
		libraryManager.inject(this);
	}

}

@@ -741,57 +741,8 @@
 er;%0A
-import com.qwazr.database.TableServiceInterface;%0A
 impo
@@ -1535,64 +1535,55 @@
 ger(
-dataDirectory.resolve(TableServiceInterface.SERVICE_NAME
+TableManager.checkTablesDirectory(dataDirectory
 ));%0A

Create tables directory