diff --git a/serveurFTP/.classpath b/serveurFTP/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..1247f9fa4a9abda01786ceb28bf76227b3293e71 --- /dev/null +++ b/serveurFTP/.classpath @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" output="target/classes" path="src/main/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="optional" value="true"/> + <attribute name="maven.pomderived" value="true"/> + <attribute name="test" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> + <attributes> + <attribute name="maven.pomderived" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/serveurFTP/.project b/serveurFTP/.project new file mode 100644 index 0000000000000000000000000000000000000000..51988d6c46aa0da6db514f3dfaa0a671ba57b356 --- /dev/null +++ b/serveurFTP/.project @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>serveurFTP</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.m2e.core.maven2Builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>org.eclipse.m2e.core.maven2Nature</nature> + </natures> +</projectDescription> diff --git a/serveurFTP/.settings/org.eclipse.core.resources.prefs b/serveurFTP/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000000000000000000000000000000000..f9fe34593fcd3624a964478aeb438b0d44fe7237 --- /dev/null +++ b/serveurFTP/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,4 @@ +eclipse.preferences.version=1 +encoding//src/main/java=UTF-8 +encoding//src/test/java=UTF-8 +encoding/<project>=UTF-8 diff --git a/serveurFTP/.settings/org.eclipse.jdt.core.prefs b/serveurFTP/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..a3b98fd01e3e2606b28f8a89cbba2c48092cc951 --- /dev/null +++ b/serveurFTP/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore +org.eclipse.jdt.core.compiler.release=disabled +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/serveurFTP/pom.xml b/serveurFTP/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..714a36bc1bc427ecf60490b576c5259d9fc9f8fd --- /dev/null +++ b/serveurFTP/pom.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>sr.projet2</groupId> + <artifactId>serveurFTP</artifactId> + <version>1.0-SNAPSHOT</version> + + <name>serveurFTP</name> + <!-- FIXME change it to the project's website --> + <url>http://www.example.com</url> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.7</maven.compiler.source> + <maven.compiler.target>1.7</maven.compiler.target> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.11</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> + <plugins> + <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>3.1.0</version> + </plugin> + <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>3.0.2</version> + </plugin> + <plugin> + <artifactId>maven-compiler-plugin</artifactId> + <version>3.8.0</version> + </plugin> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <version>2.22.1</version> + </plugin> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <version>3.0.2</version> + </plugin> + <plugin> + <artifactId>maven-install-plugin</artifactId> + <version>2.5.2</version> + </plugin> + <plugin> + <artifactId>maven-deploy-plugin</artifactId> + <version>2.8.2</version> + </plugin> + <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --> + <plugin> + <artifactId>maven-site-plugin</artifactId> + <version>3.7.1</version> + </plugin> + <plugin> + <artifactId>maven-project-info-reports-plugin</artifactId> + <version>3.0.0</version> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> diff --git a/serveurFTP/src/main/java/sr/projet2/Main.java b/serveurFTP/src/main/java/sr/projet2/Main.java new file mode 100644 index 0000000000000000000000000000000000000000..a7e6f10edfdb350e5136a2e0df6ef870c5b80bb4 --- /dev/null +++ b/serveurFTP/src/main/java/sr/projet2/Main.java @@ -0,0 +1,13 @@ +package sr.projet2; + +import java.io.IOException; + +import sr.projet2.Server.ConnectionServer; + +public class Main { + public static void main(String[] args) throws IOException{ + ConnectionServer server=new ConnectionServer(2000); + server.serverConnect(); + + } +} diff --git a/serveurFTP/src/main/java/sr/projet2/Server/ConnectionServer.java b/serveurFTP/src/main/java/sr/projet2/Server/ConnectionServer.java new file mode 100644 index 0000000000000000000000000000000000000000..3389d0d09c5979ed93810470c6fc953d34c57a12 --- /dev/null +++ b/serveurFTP/src/main/java/sr/projet2/Server/ConnectionServer.java @@ -0,0 +1,45 @@ +package sr.projet2.Server; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.ServerSocket; +import java.net.Socket; + +public class ConnectionServer { + private int PORT; + private ServerSocket srvSckt; + + public ConnectionServer (int PORT) throws IOException { + this.PORT=PORT; + server(); + + } + + + public void server() throws IOException { + try { + this.srvSckt=new ServerSocket(this.PORT); + } + catch (IOException e) { + throw new IOException("Connexion failed"); + } + + } + public void serverConnect() throws IOException { + try { + Socket socket=this.srvSckt.accept(); + BufferedReader bfR =new BufferedReader(new InputStreamReader(socket.getInputStream())); + BufferedWriter bfW = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())); + bfW.write("220 FTP SERVER\r\n"); + bfW.flush(); + } + catch(IOException e){ + e.printStackTrace(); + } + + } + +} diff --git a/serveurFTP/src/test/java/sr/projet2/AppTest.java b/serveurFTP/src/test/java/sr/projet2/AppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..329cb0aad0b70ef015ba2348eb0bc6a90e60ad5c --- /dev/null +++ b/serveurFTP/src/test/java/sr/projet2/AppTest.java @@ -0,0 +1,20 @@ +package sr.projet2; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} diff --git a/serveurFTP/target/classes/sr/projet2/Main.class b/serveurFTP/target/classes/sr/projet2/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..f0b87ee88054e2d5623baa352556a76f34f4da15 Binary files /dev/null and b/serveurFTP/target/classes/sr/projet2/Main.class differ diff --git a/serveurFTP/target/classes/sr/projet2/Server/ConnectionServer.class b/serveurFTP/target/classes/sr/projet2/Server/ConnectionServer.class new file mode 100644 index 0000000000000000000000000000000000000000..c756048d1ae1f7b554fca7ec33d5b5560e207462 Binary files /dev/null and b/serveurFTP/target/classes/sr/projet2/Server/ConnectionServer.class differ diff --git a/serveurFTP/target/maven-archiver/pom.properties b/serveurFTP/target/maven-archiver/pom.properties new file mode 100644 index 0000000000000000000000000000000000000000..2e8c1fe956d114743edff0d522cbf398f80fa723 --- /dev/null +++ b/serveurFTP/target/maven-archiver/pom.properties @@ -0,0 +1,4 @@ +#Created by Apache Maven 3.6.3 +groupId=sr.projet2 +artifactId=serveurFTP +version=1.0-SNAPSHOT diff --git a/serveurFTP/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/serveurFTP/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/serveurFTP/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/serveurFTP/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..6090f07f86be35efd41eef90e96f5f317e93159d --- /dev/null +++ b/serveurFTP/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,2 @@ +/home/hocine/eclipse-workspace/serveurFTP/src/main/java/sr/projet2/Server/ConnectionServer.java +/home/hocine/eclipse-workspace/serveurFTP/src/main/java/sr/projet2/Main.java diff --git a/serveurFTP/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/serveurFTP/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/serveurFTP/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/serveurFTP/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000000000000000000000000000000000000..2ed20fc262dad885deb29d7da7704606da27f123 --- /dev/null +++ b/serveurFTP/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst @@ -0,0 +1 @@ +/home/hocine/eclipse-workspace/serveurFTP/src/test/java/sr/projet2/AppTest.java diff --git a/serveurFTP/target/serveurFTP-1.0-SNAPSHOT.jar b/serveurFTP/target/serveurFTP-1.0-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..d5dc5f4b9b40bbb0aac801343b22bb321f72ca4c Binary files /dev/null and b/serveurFTP/target/serveurFTP-1.0-SNAPSHOT.jar differ diff --git a/serveurFTP/target/surefire-reports/TEST-sr.projet2.AppTest.xml b/serveurFTP/target/surefire-reports/TEST-sr.projet2.AppTest.xml new file mode 100644 index 0000000000000000000000000000000000000000..fe02e92f1138a2091c0d1554f50be081b44b81cd --- /dev/null +++ b/serveurFTP/target/surefire-reports/TEST-sr.projet2.AppTest.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd" name="sr.projet2.AppTest" time="0.033" tests="1" errors="0" skipped="0" failures="0"> + <properties> + <property name="sun.desktop" value="gnome"/> + <property name="awt.toolkit" value="sun.awt.X11.XToolkit"/> + <property name="java.specification.version" value="11"/> + <property name="sun.cpu.isalist" value=""/> + <property name="sun.jnu.encoding" value="UTF-8"/> + <property name="java.class.path" value="/home/hocine/eclipse-workspace/serveurFTP/target/test-classes:/home/hocine/eclipse-workspace/serveurFTP/target/classes:/home/hocine/.m2/repository/junit/junit/4.11/junit-4.11.jar:/home/hocine/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:"/> + <property name="java.vm.vendor" value="Ubuntu"/> + <property name="sun.arch.data.model" value="64"/> + <property name="java.vendor.url" value="https://ubuntu.com/"/> + <property name="user.timezone" value=""/> + <property name="java.vm.specification.version" value="11"/> + <property name="os.name" value="Linux"/> + <property name="sun.java.launcher" value="SUN_STANDARD"/> + <property name="user.country" value="FR"/> + <property name="sun.boot.library.path" value="/usr/lib/jvm/java-11-openjdk-amd64/lib"/> + <property name="sun.java.command" value="/home/hocine/eclipse-workspace/serveurFTP/target/surefire/surefirebooter14701359487179658639.jar /home/hocine/eclipse-workspace/serveurFTP/target/surefire 2021-02-11T00-09-40_142-jvmRun1 surefire2274530294192485131tmp surefire_017171065220829500292tmp"/> + <property name="jdk.debug" value="release"/> + <property name="surefire.test.class.path" value="/home/hocine/eclipse-workspace/serveurFTP/target/test-classes:/home/hocine/eclipse-workspace/serveurFTP/target/classes:/home/hocine/.m2/repository/junit/junit/4.11/junit-4.11.jar:/home/hocine/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:"/> + <property name="sun.cpu.endian" value="little"/> + <property name="user.home" value="/home/hocine"/> + <property name="user.language" value="fr"/> + <property name="java.specification.vendor" value="Oracle Corporation"/> + <property name="java.version.date" value="2021-01-19"/> + <property name="java.home" value="/usr/lib/jvm/java-11-openjdk-amd64"/> + <property name="file.separator" value="/"/> + <property name="basedir" value="/home/hocine/eclipse-workspace/serveurFTP"/> + <property name="java.vm.compressedOopsMode" value="32-bit"/> + <property name="line.separator" value=" "/> + <property name="java.specification.name" value="Java Platform API Specification"/> + <property name="java.vm.specification.vendor" value="Oracle Corporation"/> + <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/> + <property name="surefire.real.class.path" value="/home/hocine/eclipse-workspace/serveurFTP/target/surefire/surefirebooter14701359487179658639.jar"/> + <property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/> + <property name="java.runtime.version" value="11.0.10+9-Ubuntu-0ubuntu1.20.04"/> + <property name="user.name" value="hocine"/> + <property name="path.separator" value=":"/> + <property name="os.version" value="5.4.0-65-generic"/> + <property name="java.runtime.name" value="OpenJDK Runtime Environment"/> + <property name="file.encoding" value="UTF-8"/> + <property name="java.vm.name" value="OpenJDK 64-Bit Server VM"/> + <property name="localRepository" value="/home/hocine/.m2/repository"/> + <property name="java.vendor.url.bug" value="https://bugs.launchpad.net/ubuntu/+source/openjdk-lts"/> + <property name="java.io.tmpdir" value="/tmp"/> + <property name="java.version" value="11.0.10"/> + <property name="user.dir" value="/home/hocine/eclipse-workspace/serveurFTP"/> + <property name="os.arch" value="amd64"/> + <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/> + <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/> + <property name="sun.os.patch.level" value="unknown"/> + <property name="java.library.path" value="/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib"/> + <property name="java.vm.info" value="mixed mode, sharing"/> + <property name="java.vendor" value="Ubuntu"/> + <property name="java.vm.version" value="11.0.10+9-Ubuntu-0ubuntu1.20.04"/> + <property name="sun.io.unicode.encoding" value="UnicodeLittle"/> + <property name="java.class.version" value="55.0"/> + </properties> + <testcase name="shouldAnswerWithTrue" classname="sr.projet2.AppTest" time="0.001"/> +</testsuite> \ No newline at end of file diff --git a/serveurFTP/target/surefire-reports/sr.projet2.AppTest.txt b/serveurFTP/target/surefire-reports/sr.projet2.AppTest.txt new file mode 100644 index 0000000000000000000000000000000000000000..23a25bb11e03910bb92037ccc728606523b6a71e --- /dev/null +++ b/serveurFTP/target/surefire-reports/sr.projet2.AppTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: sr.projet2.AppTest +------------------------------------------------------------------------------- +Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.033 s - in sr.projet2.AppTest diff --git a/serveurFTP/target/test-classes/sr/projet2/AppTest.class b/serveurFTP/target/test-classes/sr/projet2/AppTest.class new file mode 100644 index 0000000000000000000000000000000000000000..49fd1cc203d5df763b95d89aba9b5c1ce7ddd1a1 Binary files /dev/null and b/serveurFTP/target/test-classes/sr/projet2/AppTest.class differ