/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.cuni.amis.pogamut.ut2004.bot.navigation;

import cz.cuni.amis.pogamut.ut2004.bot.*;
import cz.cuni.amis.pogamut.base.agent.IAgent;
import cz.cuni.amis.pogamut.base.agent.worldview.IWorldView;
import cz.cuni.amis.pogamut.base.communication.connection.socket.ISocketConnectionAddress;
import cz.cuni.amis.pogamut.base.communication.connection.socket.SocketConnectionAddress;
import cz.cuni.amis.pogamut.base.exceptions.PogamutException;
import cz.cuni.amis.pogamut.base.factory.IAgentFactory;
import cz.cuni.amis.pogamut.base.factory.guice.GuiceAgentFactory;
import cz.cuni.amis.pogamut.base.factory.guice.PogamutAgentModule;
import cz.cuni.amis.pogamut.ut2004.agent.worldview.UT2004LockableWorldView;
import cz.cuni.amis.pogamut.ut2004.factory.guice.UT2004BotModule;
import cz.cuni.amis.pogamut.ut2004.factory.guice.UTGuiceSyncFactory;
import cz.cuni.amis.pogamut.ut2004.testbase.ServerTestBase;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import org.junit.Test;
import static org.junit.Assert.*;

/**
 *
 * @author ik
 */
public class NavigationBotTest extends ServerTestBase {

    /* @Test
    public void navLoop() throws PogamutException, InterruptedException {
    for(int i = 0; i < 30; i++)
    createBot();
    }
     */
    @Test
    public void createBot() throws PogamutException, InterruptedException {
        IAgentFactory<ISocketConnectionAddress> factory = new UTGuiceSyncFactory(NavigatingBot.class);

        NavigatingBot bot = (NavigatingBot) factory.newAgent(createAdress());

        bot.getLogger().addConsoleHandlersToAllCategories();
        bot.getLogger().setLevel(Level.WARNING);

        bot.start();
        int N = 2000;
        if (!bot.targetReached.await(N, TimeUnit.SECONDS)) {
            fail("Bot hasn't reached its target in " + N + " seconds.");
        }
        ;
    }
}
