mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
Dev: clear pom files, fixed wrong test packages and scope, added zip tests;
This commit is contained in:
parent
6f76c3371e
commit
f9beed6a89
15 changed files with 115 additions and 41 deletions
|
@ -43,6 +43,10 @@
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.truevfs</groupId>
|
||||||
|
<artifactId>truevfs-profile-base</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- needs for server connection by jboss -->
|
<!-- needs for server connection by jboss -->
|
||||||
|
@ -88,7 +92,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -112,22 +115,6 @@
|
||||||
<artifactId>jsoup</artifactId>
|
<artifactId>jsoup</artifactId>
|
||||||
<version>1.14.2</version>
|
<version>1.14.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<artifactId>truevfs-profile-base</artifactId>
|
|
||||||
<groupId>net.java.truevfs</groupId>
|
|
||||||
<type>jar</type>
|
|
||||||
<version>0.11.1</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>truevfs-access-swing</artifactId>
|
|
||||||
<groupId>net.java.truevfs</groupId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>truecommons-key-swing</artifactId>
|
|
||||||
<groupId>net.java.truecommons</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- music player START -->
|
<!-- music player START -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
|
|
|
@ -233,37 +233,31 @@
|
||||||
<groupId>org.apache.shiro</groupId>
|
<groupId>org.apache.shiro</groupId>
|
||||||
<artifactId>shiro-core</artifactId>
|
<artifactId>shiro-core</artifactId>
|
||||||
<version>1.8.0</version>
|
<version>1.8.0</version>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.api-client</groupId>
|
<groupId>com.google.api-client</groupId>
|
||||||
<artifactId>google-api-client</artifactId>
|
<artifactId>google-api-client</artifactId>
|
||||||
<version>1.31.1</version>
|
<version>1.31.1</version>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.apis</groupId>
|
<groupId>com.google.apis</groupId>
|
||||||
<artifactId>google-api-services-gmail</artifactId>
|
<artifactId>google-api-services-gmail</artifactId>
|
||||||
<version>v1-rev20210614-1.32.1</version>
|
<version>v1-rev20210614-1.32.1</version>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.oauth-client</groupId>
|
<groupId>com.google.oauth-client</groupId>
|
||||||
<artifactId>google-oauth-client-java6</artifactId>
|
<artifactId>google-oauth-client-java6</artifactId>
|
||||||
<version>1.31.0</version>
|
<version>1.31.0</version>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.oauth-client</groupId>
|
<groupId>com.google.oauth-client</groupId>
|
||||||
<artifactId>google-oauth-client-jetty</artifactId>
|
<artifactId>google-oauth-client-jetty</artifactId>
|
||||||
<version>1.31.2</version>
|
<version>1.31.2</version>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.mail</groupId>
|
<groupId>javax.mail</groupId>
|
||||||
<artifactId>mail</artifactId>
|
<artifactId>mail</artifactId>
|
||||||
<version>1.5.0-b01</version>
|
<version>1.5.0-b01</version>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sun.jersey</groupId>
|
<groupId>com.sun.jersey</groupId>
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -34,11 +34,6 @@
|
||||||
<artifactId>mage-server</artifactId>
|
<artifactId>mage-server</artifactId>
|
||||||
<version>${mage-version}</version>
|
<version>${mage-version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
<artifactId>mage-game-twoplayerduel</artifactId>
|
<artifactId>mage-game-twoplayerduel</artifactId>
|
||||||
|
@ -52,10 +47,14 @@
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>${project.groupId}</groupId>
|
<groupId>${project.groupId}</groupId>
|
||||||
|
@ -73,6 +72,10 @@
|
||||||
<artifactId>jaxb-runtime</artifactId>
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>3.0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.truevfs</groupId>
|
||||||
|
<artifactId>truevfs-profile-base</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package mage.cards.decks;
|
package org.mage.test.decks.exporter;
|
||||||
|
|
||||||
|
import mage.cards.decks.DeckFormats;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package mage.cards.decks.exporter;
|
package org.mage.test.decks.exporter;
|
||||||
|
|
||||||
import mage.cards.decks.DeckCardInfo;
|
import mage.cards.decks.DeckCardInfo;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
|
import mage.cards.decks.exporter.DeckExporter;
|
||||||
|
import mage.cards.decks.exporter.MtgArenaDeckExporter;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
|
@ -0,0 +1,76 @@
|
||||||
|
package org.mage.test.utils;
|
||||||
|
|
||||||
|
import net.java.truevfs.access.TFile;
|
||||||
|
import net.java.truevfs.access.TFileReader;
|
||||||
|
import net.java.truevfs.access.TFileWriter;
|
||||||
|
import net.java.truevfs.access.TVFS;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public class ZipFilesReadWriteTest {
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder tempFolder = new TemporaryFolder();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_Read() {
|
||||||
|
// exists
|
||||||
|
TFile fileZip = new TFile(Paths.get("src", "test", "resources", "images.zip").toString());
|
||||||
|
Assert.assertTrue(fileZip.exists());
|
||||||
|
TFile fileZipDir = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET").toString());
|
||||||
|
Assert.assertTrue(fileZipDir.exists());
|
||||||
|
TFile fileZipFile = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET", "image1.png").toString());
|
||||||
|
Assert.assertTrue(fileZipFile.exists());
|
||||||
|
|
||||||
|
// not exists
|
||||||
|
TFile fileNotZip = new TFile(Paths.get("src", "test", "resources", "images-FAIL.zip").toString());
|
||||||
|
Assert.assertFalse(fileNotZip.exists());
|
||||||
|
TFile fileNotZipDir = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET-FAIL").toString());
|
||||||
|
Assert.assertFalse(fileNotZipDir.exists());
|
||||||
|
TFile fileNotZipFile = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET", "image1-FAIL.png").toString());
|
||||||
|
Assert.assertFalse(fileNotZipFile.exists());
|
||||||
|
|
||||||
|
// reading
|
||||||
|
Assert.assertEquals(3, fileZipDir.list().length);
|
||||||
|
Assert.assertTrue(Arrays.asList(fileZipDir.list()).contains("image1.png"));
|
||||||
|
Assert.assertTrue(Arrays.asList(fileZipDir.list()).contains("image2.png"));
|
||||||
|
Assert.assertTrue(Arrays.asList(fileZipDir.list()).contains("image3.png"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_write() {
|
||||||
|
try {
|
||||||
|
String zipPath = tempFolder.newFolder().getAbsolutePath();
|
||||||
|
TFile fileWriteZip = new TFile(Paths.get(zipPath, "temp-images.zip", "DIR", "test.txt").toString());
|
||||||
|
Assert.assertFalse(fileWriteZip.exists());
|
||||||
|
|
||||||
|
Writer writer = new TFileWriter(fileWriteZip);
|
||||||
|
try {
|
||||||
|
writer.write("test text");
|
||||||
|
writer.close();
|
||||||
|
Assert.assertTrue(fileWriteZip.exists());
|
||||||
|
|
||||||
|
TFileReader reader = new TFileReader(fileWriteZip);
|
||||||
|
BufferedReader br = new BufferedReader(reader);
|
||||||
|
Assert.assertEquals(br.readLine(), "test text");
|
||||||
|
reader.close();
|
||||||
|
} finally {
|
||||||
|
TVFS.umount();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Assert.fail(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Mage.Tests/src/test/resources/images.zip
Normal file
BIN
Mage.Tests/src/test/resources/images.zip
Normal file
Binary file not shown.
|
@ -48,7 +48,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<!-- WARNING, do not update db engine (stable: 1.4.197) cause compatibility issues, see https://github.com/h2database/h2database/issues/2078 -->
|
<!-- WARNING, do not update db engine (stable: 1.4.197) cause compatibility issues, see https://github.com/h2database/h2database/issues/2078 -->
|
||||||
|
|
|
@ -9,7 +9,6 @@ import mage.abilities.effects.ContinuousEffect;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import org.junit.Assert;
|
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -48,13 +47,13 @@ public class ConditionalContinuousEffect extends ContinuousEffectImpl {
|
||||||
// checks for compatibility
|
// checks for compatibility
|
||||||
EffectType needType = EffectType.CONTINUOUS;
|
EffectType needType = EffectType.CONTINUOUS;
|
||||||
if (effect.getEffectType() != needType) {
|
if (effect.getEffectType() != needType) {
|
||||||
Assert.fail("ConditionalContinuousEffect supports only " + needType.toString() + " but found " + effect.getEffectType().toString());
|
throw new IllegalArgumentException("ConditionalContinuousEffect supports only " + needType + " but found " + effect.getEffectType().toString());
|
||||||
}
|
}
|
||||||
if (otherwiseEffect != null && otherwiseEffect.getEffectType() != needType) {
|
if (otherwiseEffect != null && otherwiseEffect.getEffectType() != needType) {
|
||||||
Assert.fail("ConditionalContinuousEffect supports only " + needType.toString() + " but found " + effect.getEffectType().toString());
|
throw new IllegalArgumentException("ConditionalContinuousEffect supports only " + needType.toString() + " but found " + effect.getEffectType().toString());
|
||||||
}
|
}
|
||||||
if (otherwiseEffect != null && effect.getEffectType() != otherwiseEffect.getEffectType()) {
|
if (otherwiseEffect != null && effect.getEffectType() != otherwiseEffect.getEffectType()) {
|
||||||
Assert.fail("ConditionalContinuousEffect must be same but found " + effect.getEffectType().toString() + " and " + otherwiseEffect.getEffectType().toString());
|
throw new IllegalArgumentException("ConditionalContinuousEffect must be same but found " + effect.getEffectType().toString() + " and " + otherwiseEffect.getEffectType().toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
18
pom.xml
18
pom.xml
|
@ -156,11 +156,13 @@
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
<!-- write libs from all childs here to control a versions -->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.13.1</version>
|
<version>4.13.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>log4j</groupId>
|
<groupId>log4j</groupId>
|
||||||
|
@ -192,6 +194,22 @@
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.11</version>
|
<version>3.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<!-- zip files support -->
|
||||||
|
<groupId>net.java.truevfs</groupId>
|
||||||
|
<artifactId>truevfs-profile-base</artifactId>
|
||||||
|
<version>0.11.1</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>net.java.truevfs</groupId>
|
||||||
|
<artifactId>truevfs-access-swing</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>net.java.truecommons</groupId>
|
||||||
|
<artifactId>truecommons-key-swing</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
</project>
|
</project>
|
||||||
|
|
Loading…
Reference in a new issue