package com.peterphi.usermanager.db.dao;

import com.google.inject.Inject;
import com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery;
import com.peterphi.std.guice.testing.GuiceUnit;
import com.peterphi.std.guice.testing.com.peterphi.std.guice.testing.annotations.GuiceConfig;
import com.peterphi.usermanager.db.dao.hibernate.OAuthServiceDaoImpl;
import com.peterphi.usermanager.db.dao.hibernate.OAuthSessionContextDaoImpl;
import com.peterphi.usermanager.db.dao.hibernate.OAuthSessionDaoImpl;
import com.peterphi.usermanager.db.dao.hibernate.RoleDaoImpl;
import com.peterphi.usermanager.db.dao.hibernate.UserDaoImpl;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(GuiceUnit.class)
@GuiceConfig(config = "user-manager-hsqldb-in-memory.properties", packages = {"com.peterphi"})
public class CreateDatabaseSchemaTest
{
	@Inject
	UserDaoImpl userDao;

	@Inject
	RoleDaoImpl roleDao;

	@Inject
	OAuthServiceDaoImpl serviceDao;

	@Inject
	OAuthSessionDaoImpl sessionDao;

	@Inject
	OAuthSessionContextDaoImpl contextDao;


	@Test
	public void testDb()
	{
		userDao.getAll();
		roleDao.getAll();
		serviceDao.getAll();
		sessionDao.getAll();
		contextDao.getAll();
	}


	@Test
	public void test()
	{
		sessionDao.find(new WebQuery().eq("active",true).eq("service.id","123"));
	}
}

@@ -72,73 +72,8 @@
 ct;%0A
-import com.peterphi.std.guice.restclient.jaxb.webquery.WebQuery;%0A
 impo
@@ -1119,117 +1119,6 @@
 %0A%09%7D%0A
-%0A%0A%09@Test%0A%09public void test()%0A%09%7B%0A%09%09sessionDao.find(new WebQuery().eq(%22active%22,true).eq(%22service.id%22,%22123%22));%0A%09%7D%0A
 %7D%0A

Remove broken unit test to replicate Criteria issue