Skip to content
Snippets Groups Projects
Commit b93d5d2a authored by fries.pascal's avatar fries.pascal
Browse files

remove tests

parent 17a9816c
No related branches found
No related tags found
No related merge requests found
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);
}
}
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());
}
}
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());
}
}
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());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment