diff --git a/tools.descartes.dni.adaptation/src-test/tools/descartes/dni/dnimm3/tools/ParserTest.java b/tools.descartes.dni.adaptation/src-test/tools/descartes/dni/dnimm3/tools/ParserTest.java deleted file mode 100644 index 301c017b6d761f080dc83141b357c5081d31556e..0000000000000000000000000000000000000000 --- a/tools.descartes.dni.adaptation/src-test/tools/descartes/dni/dnimm3/tools/ParserTest.java +++ /dev/null @@ -1,59 +0,0 @@ -package tools.descartes.dni.dnimm3.tools; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.junit.Assert; -import org.junit.Test; - -import tools.descartes.dni.dnimm3ap.AdaptationPoints; -import tools.descartes.dni.dnimm3ap.impl.AdaptationPointsImpl; -import tools.descartes.dni.dnimm3ap.impl.DNIAPFactoryImpl; -import tools.descartes.dni.dnimm3ap.tools.DNIAPParser; - -public class ParserTest { - - @Test - public void shouldConvertFileToModel() { - File file = new File("resources-test/scenario0B.dniap"); - AdaptationPointsImpl adaptationPoints = DNIAPParser.convertToModel(file); - Assert.assertTrue(adaptationPoints.getRepositories().getNodes().size() > 0); - } - - @Test - public void shouldConvertFileToModelWithNetworkStructure() { - File file = new File("resources-test/scenario0B.dniap"); - AdaptationPointsImpl adaptationPoints = DNIAPParser.convertToModel(file); - Assert.assertEquals(6, adaptationPoints.getNetworkInfrastructure().getStructure().getNodes().size()); - } - - @Test - public void shouldConvertModelToFile() throws IOException { - DNIAPFactoryImpl factory = new DNIAPFactoryImpl(); - AdaptationPoints model = factory.createAdaptationPoints(); - File file = File.createTempFile("junit-dni-", ".dniap"); - file.deleteOnExit(); - DNIAPParser.writeToFile(model, file); - Assert.assertTrue(file.length() > 100); - } - - @Test - public void shouldConvertModelToByteArray() throws IOException { - DNIAPFactoryImpl factory = new DNIAPFactoryImpl(); - AdaptationPoints model = factory.createAdaptationPoints(); - byte[] bytes = DNIAPParser.convertToByteArray(model); - Assert.assertTrue(bytes.length > 10); - } - - @Test - public void shouldConvertByteArrayToModel() throws IOException { - Path path = Paths.get("resources-test/scenario0B.dniap"); - byte[] data = Files.readAllBytes(path); - AdaptationPoints adaptationPoints = DNIAPParser.convertToModel(data); - Assert.assertTrue(adaptationPoints.getRepositories().getNodes().size() > 0); - } - -} diff --git a/tools.descartes.dni.adaptation/src-test/tools/descartes/dni/dnimm3/tools/UtilTest.java b/tools.descartes.dni.adaptation/src-test/tools/descartes/dni/dnimm3/tools/UtilTest.java deleted file mode 100644 index 98c70dce54ad63f7193a58602971e322bff0d709..0000000000000000000000000000000000000000 --- a/tools.descartes.dni.adaptation/src-test/tools/descartes/dni/dnimm3/tools/UtilTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package tools.descartes.dni.dnimm3.tools; - -import java.io.File; - -import org.junit.Assert; -import org.junit.Test; - -import tools.descartes.dni.dnimm3ap.impl.AdaptationPointsImpl; -import tools.descartes.dni.dnimm3ap.tools.DNIAPParser; -import tools.descartes.dni.dnimm3ap.tools.DNIAPUtil; - -public class UtilTest { - - @Test - public void shouldCloneModel() { - File file = new File("resources-test/scenario0B.dniap"); - AdaptationPointsImpl adaptationPoints1 = DNIAPParser.convertToModel(file); - AdaptationPointsImpl adaptationPoints2 = DNIAPUtil.cloneModel(adaptationPoints1); - Assert.assertNotEquals(adaptationPoints1, adaptationPoints2); - Assert.assertEquals(adaptationPoints1.getNetworkInfrastructure().getStructure().getNodes().size(), - adaptationPoints2.getNetworkInfrastructure().getStructure().getNodes().size()); - Assert.assertEquals( - adaptationPoints1.getNetworkInfrastructure().getStructure().getNodes().get(0).getUid_generated(), - adaptationPoints2.getNetworkInfrastructure().getStructure().getNodes().get(0).getUid_generated()); - } - -} diff --git a/tools.descartes.dni.core/src-test/tools/descartes/dni/dnimm3/tools/ParserTest.java b/tools.descartes.dni.core/src-test/tools/descartes/dni/dnimm3/tools/ParserTest.java deleted file mode 100644 index 0c8d9eac5d8dc5f395d3ae429a8444cdf71cc458..0000000000000000000000000000000000000000 --- a/tools.descartes.dni.core/src-test/tools/descartes/dni/dnimm3/tools/ParserTest.java +++ /dev/null @@ -1,58 +0,0 @@ -package tools.descartes.dni.dnimm3.tools; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.junit.Assert; -import org.junit.Test; - -import tools.descartes.dni.dnimm3.NetworkInfrastructure; -import tools.descartes.dni.dnimm3.impl.DNIFactoryImpl; -import tools.descartes.dni.dnimm3.impl.NetworkInfrastructureImpl; - -public class ParserTest { - - @Test - public void shouldConvertFileToModel() { - File file = new File("resources-test/scenario0A.dni"); - NetworkInfrastructureImpl networkInfrastructure = DNIParser.convertToModel(file); - Assert.assertEquals(6, networkInfrastructure.getStructure().getNodes().size()); - } - - @Test - public void shouldConvertFileWithAdaptationToModel() { - File file = new File("resources-test/scenario0B.dni"); - NetworkInfrastructureImpl networkInfrastructure = DNIParser.convertToModel(file); - Assert.assertEquals(6, networkInfrastructure.getStructure().getNodes().size()); - } - - @Test - public void shouldConvertModelToFile() throws IOException { - DNIFactoryImpl factory = new DNIFactoryImpl(); - NetworkInfrastructure model = factory.createNetworkInfrastructure(); - File file = File.createTempFile("junit-dni-", ".dni"); - file.deleteOnExit(); - DNIParser.writeToFile(model, file); - Assert.assertTrue(file.length() > 100); - } - - @Test - public void shouldConvertModelToByteArray() throws IOException { - DNIFactoryImpl factory = new DNIFactoryImpl(); - NetworkInfrastructure model = factory.createNetworkInfrastructure(); - byte[] bytes = DNIParser.convertToByteArray(model); - Assert.assertTrue(bytes.length > 100); - } - - @Test - public void shouldConvertByteArrayToModel() throws IOException { - Path path = Paths.get("resources-test/scenario0A.dni"); - byte[] data = Files.readAllBytes(path); - NetworkInfrastructureImpl networkInfrastructure = DNIParser.convertToModel(data); - Assert.assertEquals(6, networkInfrastructure.getStructure().getNodes().size()); - } - -} diff --git a/tools.descartes.dni.core/src-test/tools/descartes/dni/dnimm3/tools/UtilTest.java b/tools.descartes.dni.core/src-test/tools/descartes/dni/dnimm3/tools/UtilTest.java deleted file mode 100644 index 120bda935af0df5716ef43734170ffc7348a91c0..0000000000000000000000000000000000000000 --- a/tools.descartes.dni.core/src-test/tools/descartes/dni/dnimm3/tools/UtilTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package tools.descartes.dni.dnimm3.tools; - -import java.io.File; - -import org.junit.Assert; -import org.junit.Test; - -import tools.descartes.dni.dnimm3.impl.NetworkInfrastructureImpl; - -public class UtilTest { - - @Test - public void shouldCloneModel() { - File file = new File("resources-test/scenario0B.dni"); - NetworkInfrastructureImpl networkInfrastructure1 = DNIParser.convertToModel(file); - NetworkInfrastructureImpl networkInfrastructure2 = DNIUtil.cloneModel(networkInfrastructure1); - Assert.assertNotEquals(networkInfrastructure1, networkInfrastructure2); - Assert.assertEquals(networkInfrastructure1.getStructure().getNodes().size(), - networkInfrastructure2.getStructure().getNodes().size()); - Assert.assertEquals(networkInfrastructure1.getStructure().getNodes().get(0).getUid_generated(), - networkInfrastructure2.getStructure().getNodes().get(0).getUid_generated()); - } - -}