minor changes in test logging level

This commit is contained in:
magenoxx 2012-05-15 11:54:47 +04:00
parent cd7e10e186
commit 3fb7dc2993
3 changed files with 15 additions and 17 deletions

View file

@ -12,6 +12,7 @@ import org.mage.test.serverside.base.CardTestBase;
* *
* @ayratn * @ayratn
*/ */
@Ignore
public class BurntheImpureTest extends CardTestBase { public class BurntheImpureTest extends CardTestBase {
/** /**
@ -25,7 +26,6 @@ public class BurntheImpureTest extends CardTestBase {
* @throws Exception * @throws Exception
*/ */
@Test @Test
@Ignore
public void testVersusInfectCreature() throws Exception { public void testVersusInfectCreature() throws Exception {
// $include red.default // $include red.default
useRedDefault(); useRedDefault();

View file

@ -1,7 +1,5 @@
package org.mage.test.serverside.base; package org.mage.test.serverside.base;
import java.io.File;
import java.io.FileNotFoundException;
import mage.Constants; import mage.Constants;
import mage.Constants.PhaseStep; import mage.Constants.PhaseStep;
import mage.cards.Card; import mage.cards.Card;
@ -19,6 +17,9 @@ import org.junit.Before;
import org.mage.test.player.TestPlayer; import org.mage.test.player.TestPlayer;
import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl; import org.mage.test.serverside.base.impl.CardTestPlayerAPIImpl;
import java.io.File;
import java.io.FileNotFoundException;
/** /**
* Base class for testing single cards and effects. * Base class for testing single cards and effects.
* *
@ -47,7 +48,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
@Before @Before
public void reset() throws GameException, FileNotFoundException { public void reset() throws GameException, FileNotFoundException {
if (currentGame != null) { if (currentGame != null) {
logger.info("Resetting previous game and creating new one!"); logger.debug("Resetting previous game and creating new one!");
currentGame = null; currentGame = null;
System.gc(); System.gc();
} }
@ -56,9 +57,9 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
playerA = createNewPlayer("PlayerA"); playerA = createNewPlayer("PlayerA");
playerA.setTestMode(true); playerA.setTestMode(true);
logger.info("Loading deck..."); logger.debug("Loading deck...");
Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck")); Deck deck = Deck.load(DeckImporterUtil.importDeck("RB Aggro.dck"));
logger.info("Done!"); logger.debug("Done!");
if (deck.getCards().size() < 40) { if (deck.getCards().size() < 40) {
throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size()); throw new IllegalArgumentException("Couldn't load deck, deck size=" + deck.getCards().size());
} }
@ -103,7 +104,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
} }
if (currentGame != null) { if (currentGame != null) {
logger.info("Resetting previous game and creating new one!"); logger.debug("Resetting previous game and creating new one!");
currentGame = null; currentGame = null;
System.gc(); System.gc();
} }
@ -159,8 +160,8 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
gameOptions.stopAtStep = stopAtStep; gameOptions.stopAtStep = stopAtStep;
currentGame.start(activePlayer.getId(), gameOptions); currentGame.start(activePlayer.getId(), gameOptions);
long t2 = System.nanoTime(); long t2 = System.nanoTime();
logger.info("Winner: " + currentGame.getWinner()); logger.debug("Winner: " + currentGame.getWinner());
logger.info("Time: " + (t2 - t1) / 1000000 + " ms"); logger.info("Test has been executed. Execution time: " + (t2 - t1) / 1000000 + " ms");
assertTheResults(); assertTheResults();
} }
@ -169,7 +170,7 @@ public abstract class CardTestPlayerBase extends CardTestPlayerAPIImpl {
* Assert expected and actual results. * Assert expected and actual results.
*/ */
private void assertTheResults() { private void assertTheResults() {
logger.info("Matching expected results:"); logger.debug("Matching expected results:");
for (String line : expectedResults) { for (String line : expectedResults) {
boolean ok = false; boolean ok = false;
try { try {

View file

@ -1,16 +1,14 @@
package org.mage.test.serverside.base; package org.mage.test.serverside.base;
import mage.Constants; import mage.Constants;
import mage.Constants.PhaseStep;
import mage.cards.Card; import mage.cards.Card;
import mage.game.Game; import mage.game.Game;
import mage.game.match.MatchType; import mage.game.match.MatchType;
import mage.game.permanent.PermanentCard; import mage.game.permanent.PermanentCard;
import mage.game.tournament.TournamentType; import mage.game.tournament.TournamentType;
import mage.players.Player; import mage.players.Player;
import mage.server.game.DeckValidatorFactory;
import mage.server.game.GameFactory; import mage.server.game.GameFactory;
import mage.server.game.PlayerFactory;
import mage.server.tournament.TournamentFactory;
import mage.server.util.ConfigSettings; import mage.server.util.ConfigSettings;
import mage.server.util.PluginClassLoader; import mage.server.util.PluginClassLoader;
import mage.server.util.config.GamePlugin; import mage.server.util.config.GamePlugin;
@ -20,6 +18,7 @@ import mage.util.Copier;
import org.apache.log4j.Level; import org.apache.log4j.Level;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.mage.test.player.TestPlayer;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -27,8 +26,6 @@ import java.io.FilenameFilter;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import mage.Constants.PhaseStep;
import org.mage.test.player.TestPlayer;
/** /**
* Base class for all tests. * Base class for all tests.
@ -101,8 +98,8 @@ public abstract class MageTestPlayerBase {
@BeforeClass @BeforeClass
public static void init() { public static void init() {
Logger.getRootLogger().setLevel(Level.DEBUG); Logger.getRootLogger().setLevel(Level.DEBUG);
logger.info("Starting MAGE tests"); logger.debug("Starting MAGE tests");
logger.info("Logging level: " + logger.getLevel()); logger.debug("Logging level: " + logger.getLevel());
deleteSavedGames(); deleteSavedGames();
ConfigSettings config = ConfigSettings.getInstance(); ConfigSettings config = ConfigSettings.getInstance();
for (GamePlugin plugin : config.getGameTypes()) { for (GamePlugin plugin : config.getGameTypes()) {