Commit a91f65e8 authored by Grzegorz Pietrusza's avatar Grzegorz Pietrusza

cleanup

parent 06dcb2b1
...@@ -5,8 +5,6 @@ import com.google.common.collect.ImmutableSet; ...@@ -5,8 +5,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.reflect.ClassPath; import com.google.common.reflect.ClassPath;
import com.google.inject.Guice; import com.google.inject.Guice;
import com.google.inject.Injector; import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
import com.telephoners.krakyournet.ctf.beans.User; import com.telephoners.krakyournet.ctf.beans.User;
import com.telephoners.krakyournet.ctf.commands.PurgeDatabaseCommand; import com.telephoners.krakyournet.ctf.commands.PurgeDatabaseCommand;
import com.telephoners.krakyournet.ctf.commands.RegisterTasksCommand; import com.telephoners.krakyournet.ctf.commands.RegisterTasksCommand;
...@@ -14,8 +12,6 @@ import com.telephoners.krakyournet.ctf.commands.RegisterTeamsCommand; ...@@ -14,8 +12,6 @@ import com.telephoners.krakyournet.ctf.commands.RegisterTeamsCommand;
import com.telephoners.krakyournet.ctf.core.ApplicationConfiguration; import com.telephoners.krakyournet.ctf.core.ApplicationConfiguration;
import com.telephoners.krakyournet.ctf.logging.LoggingFilter; import com.telephoners.krakyournet.ctf.logging.LoggingFilter;
import com.telephoners.krakyournet.ctf.modules.ApplicationModule; import com.telephoners.krakyournet.ctf.modules.ApplicationModule;
import com.telephoners.krakyournet.ctf.repositories.Repository;
import com.telephoners.krakyournet.ctf.repositories.SofaRepository;
import io.dropwizard.Application; import io.dropwizard.Application;
import io.dropwizard.assets.AssetsBundle; import io.dropwizard.assets.AssetsBundle;
import io.dropwizard.auth.AuthValueFactoryProvider; import io.dropwizard.auth.AuthValueFactoryProvider;
...@@ -26,7 +22,6 @@ import org.ektorp.CouchDbConnector; ...@@ -26,7 +22,6 @@ import org.ektorp.CouchDbConnector;
import org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature; import org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
public class CTFApplication extends Application<ApplicationConfiguration> public class CTFApplication extends Application<ApplicationConfiguration>
...@@ -75,21 +70,6 @@ public class CTFApplication extends Application<ApplicationConfiguration> ...@@ -75,21 +70,6 @@ public class CTFApplication extends Application<ApplicationConfiguration>
CouchDbConnector connector = injector.getInstance(CouchDbConnector.class); CouchDbConnector connector = injector.getInstance(CouchDbConnector.class);
SofaRepository sofaRepository = new SofaRepository(User.class, connector);
User user1 = new User("asdf", "Asdf", "dgsdfg", false);
User user2 = new User("asdf","Asdf","dgsdfg",false);
User user3 = new User("asdf","Asdf","dgsdfg",false);
sofaRepository.add(user1);
sofaRepository.add(user2);
sofaRepository.add(user3);
List<User> all = sofaRepository.getAll();
Repository<User> instance = injector.getInstance(Key.get(new TypeLiteral<Repository<User>>()
{
}));
registerAdmins(applicationConfiguration); registerAdmins(applicationConfiguration);
registerResources(environment); registerResources(environment);
registerAuthFeatures(environment); registerAuthFeatures(environment);
......
package com.telephoners.krakyournet.ctf.repositories;
import com.telephoners.krakyournet.ctf.beans.User;
import org.ektorp.CouchDbConnector;
import org.ektorp.support.CouchDbRepositorySupport;
//todo: move to module
//@Singleton //todo
public class SofaRepository extends CouchDbRepositorySupport<User>
{
public SofaRepository(Class<User> type, CouchDbConnector db)
{
super(type, db);
}
}
...@@ -6,7 +6,6 @@ import com.telephoners.krakyournet.ctf.beans.Team; ...@@ -6,7 +6,6 @@ import com.telephoners.krakyournet.ctf.beans.Team;
import com.telephoners.krakyournet.ctf.exceptions.SolutionAlreadySubmittedException; import com.telephoners.krakyournet.ctf.exceptions.SolutionAlreadySubmittedException;
import org.ektorp.CouchDbConnector; import org.ektorp.CouchDbConnector;
import javax.inject.Singleton;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment