Browse Source

removed subprojects

develop
Robin Thoni 8 years ago
parent
commit
3868e572eb
28 changed files with 64 additions and 214 deletions
  1. 0
    16
      client/client.iml
  2. 0
    22
      client/pom.xml
  3. 0
    17
      common/common.iml
  4. 0
    29
      common/pom.xml
  5. 4
    13
      pom.xml
  6. 0
    23
      server/pom.xml
  7. 0
    18
      server/server.iml
  8. 1
    1
      src/main/java/com/uqac/rthoni/java_rmi/Main.java
  9. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/client/ClientApplication.java
  10. 0
    1
      src/main/java/com/uqac/rthoni/java_rmi/common/Command.java
  11. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/common/ReflectionUtil.java
  12. 0
    1
      src/main/java/com/uqac/rthoni/java_rmi/server/ServerApplication.java
  13. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/AbstractCommandExecutor.java
  14. 0
    3
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/ClassBuilderExecutor.java
  15. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/ClassLoaderExecutor.java
  16. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/MethodExecutor.java
  17. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/NewInstanceExecutor.java
  18. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/ReadExecutor.java
  19. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/TestExecutor.java
  20. 0
    0
      src/main/java/com/uqac/rthoni/java_rmi/server/executors/WriteExecutor.java
  21. 21
    24
      src/test/java/com/uqac/rthoni/java_rmi/common/CommandTest.java
  22. 0
    0
      src/test/java/com/uqac/rthoni/java_rmi/server/executors/AbstractTest.java
  23. 6
    7
      src/test/java/com/uqac/rthoni/java_rmi/server/executors/MethodExecutorTest.java
  24. 7
    11
      src/test/java/com/uqac/rthoni/java_rmi/server/executors/NewInstanceExecutorTest.java
  25. 7
    8
      src/test/java/com/uqac/rthoni/java_rmi/server/executors/ReadExecutorTest.java
  26. 0
    0
      src/test/java/com/uqac/rthoni/java_rmi/server/executors/TestDbo.java
  27. 16
    17
      src/test/java/com/uqac/rthoni/java_rmi/server/executors/WriteExecutorTest.java
  28. 2
    3
      uqac-java-rmi.iml

+ 0
- 16
client/client.iml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
-      <excludeFolder url="file://$MODULE_DIR$/target" />
11
-    </content>
12
-    <orderEntry type="inheritedJdk" />
13
-    <orderEntry type="sourceFolder" forTests="false" />
14
-    <orderEntry type="module" module-name="common" />
15
-  </component>
16
-</module>

+ 0
- 22
client/pom.xml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project xmlns="http://maven.apache.org/POM/4.0.0"
3
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
-    <parent>
6
-        <artifactId>java-rmi</artifactId>
7
-        <groupId>com.uqac.rthoni</groupId>
8
-        <version>0.1</version>
9
-    </parent>
10
-    <modelVersion>4.0.0</modelVersion>
11
-
12
-    <artifactId>client</artifactId>
13
-    <dependencies>
14
-        <dependency>
15
-            <groupId>com.uqac.rthoni</groupId>
16
-            <artifactId>common</artifactId>
17
-            <version>0.1</version>
18
-        </dependency>
19
-    </dependencies>
20
-
21
-
22
-</project>

+ 0
- 17
common/common.iml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
-      <excludeFolder url="file://$MODULE_DIR$/target" />
11
-    </content>
12
-    <orderEntry type="inheritedJdk" />
13
-    <orderEntry type="sourceFolder" forTests="false" />
14
-    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
15
-    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
16
-  </component>
17
-</module>

+ 0
- 29
common/pom.xml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project xmlns="http://maven.apache.org/POM/4.0.0"
3
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
-    <parent>
6
-        <artifactId>java-rmi</artifactId>
7
-        <groupId>com.uqac.rthoni</groupId>
8
-        <version>0.1</version>
9
-    </parent>
10
-    <modelVersion>4.0.0</modelVersion>
11
-
12
-    <artifactId>common</artifactId>
13
-    <dependencies>
14
-        <dependency>
15
-            <groupId>junit</groupId>
16
-            <artifactId>junit</artifactId>
17
-            <version>4.12</version>
18
-            <scope>test</scope>
19
-        </dependency>
20
-        <dependency>
21
-            <groupId>junit</groupId>
22
-            <artifactId>junit</artifactId>
23
-            <version>4.12</version>
24
-            <scope>test</scope>
25
-        </dependency>
26
-    </dependencies>
27
-
28
-
29
-</project>

+ 4
- 13
pom.xml View File

8
     <artifactId>java-rmi</artifactId>
8
     <artifactId>java-rmi</artifactId>
9
     <packaging>pom</packaging>
9
     <packaging>pom</packaging>
10
     <version>0.1</version>
10
     <version>0.1</version>
11
-    <modules>
12
-        <module>server</module>
13
-        <module>client</module>
14
-        <module>common</module>
15
-    </modules>
16
     <dependencies>
11
     <dependencies>
17
         <dependency>
12
         <dependency>
18
-            <groupId>com.uqac.rthoni</groupId>
19
-            <artifactId>client</artifactId>
20
-            <version>0.1</version>
21
-        </dependency>
22
-        <dependency>
23
-            <groupId>com.uqac.rthoni</groupId>
24
-            <artifactId>server</artifactId>
25
-            <version>0.1</version>
13
+            <groupId>junit</groupId>
14
+            <artifactId>junit</artifactId>
15
+            <version>4.12</version>
16
+            <scope>test</scope>
26
         </dependency>
17
         </dependency>
27
     </dependencies>
18
     </dependencies>
28
 
19
 

+ 0
- 23
server/pom.xml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project xmlns="http://maven.apache.org/POM/4.0.0"
3
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
-    <parent>
6
-        <artifactId>java-rmi</artifactId>
7
-        <groupId>com.uqac.rthoni</groupId>
8
-        <version>0.1</version>
9
-    </parent>
10
-    <modelVersion>4.0.0</modelVersion>
11
-
12
-    <artifactId>server</artifactId>
13
-    <dependencies>
14
-        <dependency>
15
-            <groupId>junit</groupId>
16
-            <artifactId>junit</artifactId>
17
-            <version>4.12</version>
18
-            <scope>test</scope>
19
-        </dependency>
20
-    </dependencies>
21
-
22
-
23
-</project>

+ 0
- 18
server/server.iml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
-      <excludeFolder url="file://$MODULE_DIR$/target" />
11
-    </content>
12
-    <orderEntry type="inheritedJdk" />
13
-    <orderEntry type="sourceFolder" forTests="false" />
14
-    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
15
-    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
16
-    <orderEntry type="module" module-name="common" />
17
-  </component>
18
-</module>

+ 1
- 1
src/main/java/com/uqac/rthoni/java_rmi/Main.java View File

60
             usage(name, true);
60
             usage(name, true);
61
         }
61
         }
62
         String mode = args[0];
62
         String mode = args[0];
63
-        if (mode.equals("server")) {
63
+        if (mode.equals("com/uqac/rthoni/java_rmi/server")) {
64
             int port = getPort(name, args[1]);
64
             int port = getPort(name, args[1]);
65
             String sourceDir = args[2];
65
             String sourceDir = args[2];
66
             String classDir = args[3];
66
             String classDir = args[3];

client/src/main/java/com/uqac/rthoni/java_rmi/client/ClientApplication.java → src/main/java/com/uqac/rthoni/java_rmi/client/ClientApplication.java View File


common/src/main/java/com/uqac/rthoni/java_rmi/common/Command.java → src/main/java/com/uqac/rthoni/java_rmi/common/Command.java View File

2
 
2
 
3
 import java.io.Serializable;
3
 import java.io.Serializable;
4
 import java.util.Arrays;
4
 import java.util.Arrays;
5
-import java.util.Collections;
6
 import java.util.Vector;
5
 import java.util.Vector;
7
 import java.util.stream.Collectors;
6
 import java.util.stream.Collectors;
8
 
7
 

common/src/main/java/com/uqac/rthoni/java_rmi/common/ReflectionUtil.java → src/main/java/com/uqac/rthoni/java_rmi/common/ReflectionUtil.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/ServerApplication.java → src/main/java/com/uqac/rthoni/java_rmi/server/ServerApplication.java View File

2
 
2
 
3
 import com.uqac.rthoni.java_rmi.server.executors.AbstractCommandExecutor;
3
 import com.uqac.rthoni.java_rmi.server.executors.AbstractCommandExecutor;
4
 import com.uqac.rthoni.java_rmi.common.Command;
4
 import com.uqac.rthoni.java_rmi.common.Command;
5
-import javafx.beans.binding.ObjectExpression;
6
 
5
 
7
 import java.io.BufferedReader;
6
 import java.io.BufferedReader;
8
 import java.io.IOException;
7
 import java.io.IOException;

server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/AbstractCommandExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/AbstractCommandExecutor.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/ClassBuilderExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/ClassBuilderExecutor.java View File

7
 import javax.tools.ToolProvider;
7
 import javax.tools.ToolProvider;
8
 import java.io.ByteArrayOutputStream;
8
 import java.io.ByteArrayOutputStream;
9
 import java.io.File;
9
 import java.io.File;
10
-import java.net.URL;
11
-import java.net.URLClassLoader;
12
 import java.nio.charset.StandardCharsets;
10
 import java.nio.charset.StandardCharsets;
13
-import java.nio.file.Files;
14
 import java.util.List;
11
 import java.util.List;
15
 import java.util.Vector;
12
 import java.util.Vector;
16
 import java.util.stream.Collectors;
13
 import java.util.stream.Collectors;

server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/ClassLoaderExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/ClassLoaderExecutor.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/MethodExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/MethodExecutor.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/NewInstanceExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/NewInstanceExecutor.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/ReadExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/ReadExecutor.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/TestExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/TestExecutor.java View File


server/src/main/java/com/uqac/rthoni/java_rmi/server/executors/WriteExecutor.java → src/main/java/com/uqac/rthoni/java_rmi/server/executors/WriteExecutor.java View File


common/src/test/java/com/uqac/rthoni/java_rmi/common/CommandTest.java → src/test/java/com/uqac/rthoni/java_rmi/common/CommandTest.java View File

1
 package com.uqac.rthoni.java_rmi.common;
1
 package com.uqac.rthoni.java_rmi.common;
2
 
2
 
3
-import com.sun.corba.se.impl.orbutil.ObjectWriter;
3
+import com.uqac.rthoni.java_rmi.common.Command;
4
+import org.junit.Assert;
4
 import org.junit.Test;
5
 import org.junit.Test;
5
 
6
 
6
-import java.io.ByteArrayOutputStream;
7
-import java.io.ObjectOutputStream;
8
-
9
-import static org.junit.Assert.*;
10
 
7
 
11
 /**
8
 /**
12
  * Created by robin on 9/15/16.
9
  * Created by robin on 9/15/16.
28
     {
25
     {
29
         Command c = new Command(null);
26
         Command c = new Command(null);
30
         String result = commandToString(c);
27
         String result = commandToString(c);
31
-        assertEquals(result, "Unknown");
28
+        Assert.assertEquals(result, "Unknown");
32
     }
29
     }
33
 
30
 
34
     @Test
31
     @Test
36
     {
33
     {
37
         Command c = new Command("");
34
         Command c = new Command("");
38
         String result = commandToString(c);
35
         String result = commandToString(c);
39
-        assertEquals(result, "Unknown");
36
+        Assert.assertEquals(result, "Unknown");
40
     }
37
     }
41
 
38
 
42
     @Test
39
     @Test
44
     {
41
     {
45
         Command c = new Command("Test");
42
         Command c = new Command("Test");
46
         String result = commandToString(c);
43
         String result = commandToString(c);
47
-        assertEquals(result, "Test");
44
+        Assert.assertEquals(result, "Test");
48
     }
45
     }
49
 
46
 
50
     @Test
47
     @Test
53
         Command c = new Command("Test");
50
         Command c = new Command("Test");
54
         c.addArgument("an_argument");
51
         c.addArgument("an_argument");
55
         String result = commandToString(c);
52
         String result = commandToString(c);
56
-        assertEquals(result, "Test#an_argument");
53
+        Assert.assertEquals(result, "Test#an_argument");
57
     }
54
     }
58
 
55
 
59
     @Test
56
     @Test
63
         c.addArgument("an_argument");
60
         c.addArgument("an_argument");
64
         c.addArgument("an_argument2");
61
         c.addArgument("an_argument2");
65
         String result = commandToString(c);
62
         String result = commandToString(c);
66
-        assertEquals(result, "Test#an_argument#an_argument2");
63
+        Assert.assertEquals(result, "Test#an_argument#an_argument2");
67
     }
64
     }
68
 
65
 
69
     @Test
66
     @Test
70
     public void testCommandDeserializeNull() throws Exception
67
     public void testCommandDeserializeNull() throws Exception
71
     {
68
     {
72
         Command c = Command.fromString(null);
69
         Command c = Command.fromString(null);
73
-        assertNull(c);
70
+        Assert.assertNull(c);
74
     }
71
     }
75
 
72
 
76
     @Test
73
     @Test
77
     public void testCommandDeserializeEmpty() throws Exception
74
     public void testCommandDeserializeEmpty() throws Exception
78
     {
75
     {
79
         Command c = Command.fromString("");
76
         Command c = Command.fromString("");
80
-        assertNull(c);
77
+        Assert.assertNull(c);
81
     }
78
     }
82
 
79
 
83
     @Test
80
     @Test
84
     public void testCommandDeserializeName() throws Exception
81
     public void testCommandDeserializeName() throws Exception
85
     {
82
     {
86
         Command c = Command.fromString("Test");
83
         Command c = Command.fromString("Test");
87
-        assertNotNull(c);
88
-        assertEquals(c.getCommandName(), "Test");
89
-        assertEquals(c.getArgumentCount(), 0);
84
+        Assert.assertNotNull(c);
85
+        Assert.assertEquals(c.getCommandName(), "Test");
86
+        Assert.assertEquals(c.getArgumentCount(), 0);
90
     }
87
     }
91
 
88
 
92
     @Test
89
     @Test
93
     public void testCommandDeserializeArgument() throws Exception
90
     public void testCommandDeserializeArgument() throws Exception
94
     {
91
     {
95
         Command c = Command.fromString("Test#an_argument");
92
         Command c = Command.fromString("Test#an_argument");
96
-        assertNotNull(c);
97
-        assertEquals(c.getCommandName(), "Test");
98
-        assertEquals(c.getArgumentCount(), 1);
99
-        assertEquals(c.getArgument(0, false), "an_argument");
93
+        Assert.assertNotNull(c);
94
+        Assert.assertEquals(c.getCommandName(), "Test");
95
+        Assert.assertEquals(c.getArgumentCount(), 1);
96
+        Assert.assertEquals(c.getArgument(0, false), "an_argument");
100
     }
97
     }
101
 
98
 
102
     @Test
99
     @Test
103
     public void testCommandDeserializeArguments() throws Exception
100
     public void testCommandDeserializeArguments() throws Exception
104
     {
101
     {
105
         Command c = Command.fromString("Test#an_argument#an_argument2");
102
         Command c = Command.fromString("Test#an_argument#an_argument2");
106
-        assertNotNull(c);
107
-        assertEquals(c.getCommandName(), "Test");
108
-        assertEquals(c.getArgumentCount(), 2);
109
-        assertEquals(c.getArgument(0, false), "an_argument");
110
-        assertEquals(c.getArgument(1, false), "an_argument2");
103
+        Assert.assertNotNull(c);
104
+        Assert.assertEquals(c.getCommandName(), "Test");
105
+        Assert.assertEquals(c.getArgumentCount(), 2);
106
+        Assert.assertEquals(c.getArgument(0, false), "an_argument");
107
+        Assert.assertEquals(c.getArgument(1, false), "an_argument2");
111
     }
108
     }
112
 }
109
 }

server/src/test/java/com/uqac/rthoni/java_rmi/server/executors/AbstractTest.java → src/test/java/com/uqac/rthoni/java_rmi/server/executors/AbstractTest.java View File


server/src/test/java/com/uqac/rthoni/java_rmi/server/executors/MethodExecutorTest.java → src/test/java/com/uqac/rthoni/java_rmi/server/executors/MethodExecutorTest.java View File

1
 package com.uqac.rthoni.java_rmi.server.executors;
1
 package com.uqac.rthoni.java_rmi.server.executors;
2
 
2
 
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
4
+import org.junit.Assert;
4
 import org.junit.Test;
5
 import org.junit.Test;
5
 
6
 
6
-import static org.junit.Assert.*;
7
-
8
 /**
7
 /**
9
  * Created by robin on 9/16/16.
8
  * Created by robin on 9/16/16.
10
  */
9
  */
16
         ServerApplication app = getServer();
15
         ServerApplication app = getServer();
17
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
16
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
18
                 "fonction#test#getMyself#java.lang.String:a_value");
17
                 "fonction#test#getMyself#java.lang.String:a_value");
19
-        assertEquals("a_value", res);
18
+        Assert.assertEquals("a_value", res);
20
     }
19
     }
21
 
20
 
22
     @Test
21
     @Test
25
         ServerApplication app = getServer();
24
         ServerApplication app = getServer();
26
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
25
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
27
                 "fonction#test#uselessMethod#int:42,int:24,java.lang.String:a_value");
26
                 "fonction#test#uselessMethod#int:42,int:24,java.lang.String:a_value");
28
-        assertEquals("NULL", res);
27
+        Assert.assertEquals("NULL", res);
29
     }
28
     }
30
 
29
 
31
     @Test
30
     @Test
36
                 "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
35
                 "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
37
                 "ecriture#test2#privateString#some_value",
36
                 "ecriture#test2#privateString#some_value",
38
                 "fonction#test#getMyString#com.uqac.rthoni.java_rmi.server.executors.TestDbo:ID(test2)");
37
                 "fonction#test#getMyString#com.uqac.rthoni.java_rmi.server.executors.TestDbo:ID(test2)");
39
-        assertEquals("some_value", res);
38
+        Assert.assertEquals("some_value", res);
40
     }
39
     }
41
 
40
 
42
     @Test
41
     @Test
47
                 "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
46
                 "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
48
                 "fonction#test2#setPrivateString#java.lang.String:some_value",
47
                 "fonction#test2#setPrivateString#java.lang.String:some_value",
49
                 "fonction#test#getMyString#com.uqac.rthoni.java_rmi.server.executors.TestDbo:ID(test2)");
48
                 "fonction#test#getMyString#com.uqac.rthoni.java_rmi.server.executors.TestDbo:ID(test2)");
50
-        assertEquals("NULL\nsome_value", res);
49
+        Assert.assertEquals("NULL\nsome_value", res);
51
     }
50
     }
52
 
51
 
53
     @Test
52
     @Test
58
                 "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
57
                 "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test2",
59
                 "fonction#test#setPrivateString#java.lang.String:some_value",
58
                 "fonction#test#setPrivateString#java.lang.String:some_value",
60
                 "fonction#test#getPrivateString");
59
                 "fonction#test#getPrivateString");
61
-        assertEquals("NULL\nsome_value", res);
60
+        Assert.assertEquals("NULL\nsome_value", res);
62
     }
61
     }
63
 }
62
 }

server/src/test/java/com/uqac/rthoni/java_rmi/server/executors/NewInstanceExecutorTest.java → src/test/java/com/uqac/rthoni/java_rmi/server/executors/NewInstanceExecutorTest.java View File

1
 package com.uqac.rthoni.java_rmi.server.executors;
1
 package com.uqac.rthoni.java_rmi.server.executors;
2
 
2
 
3
-import com.uqac.rthoni.java_rmi.common.Command;
4
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
4
+import org.junit.Assert;
5
 import org.junit.Test;
5
 import org.junit.Test;
6
 
6
 
7
-import java.util.Arrays;
8
-
9
-import static org.junit.Assert.*;
10
-
11
 /**
7
 /**
12
  * Created by robin on 9/16/16.
8
  * Created by robin on 9/16/16.
13
  */
9
  */
18
     {
14
     {
19
         ServerApplication app = getServer();
15
         ServerApplication app = getServer();
20
         String res = runCommand(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test");
16
         String res = runCommand(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test");
21
-        assertNull(res);
17
+        Assert.assertNull(res);
22
         Object obj = app.getObject("test");
18
         Object obj = app.getObject("test");
23
-        assertNotNull(obj);
24
-        assertEquals(obj.toString(), "privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true");
19
+        Assert.assertNotNull(obj);
20
+        Assert.assertEquals(obj.toString(), "privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true");
25
     }
21
     }
26
 
22
 
27
     @Test
23
     @Test
29
     {
25
     {
30
         ServerApplication app = getServer();
26
         ServerApplication app = getServer();
31
         String res = runCommand(app, "creation#java.lang.String#mystr");
27
         String res = runCommand(app, "creation#java.lang.String#mystr");
32
-        assertNull(res);
28
+        Assert.assertNull(res);
33
         Object obj = app.getObject("mystr");
29
         Object obj = app.getObject("mystr");
34
-        assertNotNull(obj);
35
-        assertEquals(obj.toString(), "");
30
+        Assert.assertNotNull(obj);
31
+        Assert.assertEquals(obj.toString(), "");
36
     }
32
     }
37
 
33
 
38
     @Test(expected = ClassNotFoundException.class)
34
     @Test(expected = ClassNotFoundException.class)

server/src/test/java/com/uqac/rthoni/java_rmi/server/executors/ReadExecutorTest.java → src/test/java/com/uqac/rthoni/java_rmi/server/executors/ReadExecutorTest.java View File

1
 package com.uqac.rthoni.java_rmi.server.executors;
1
 package com.uqac.rthoni.java_rmi.server.executors;
2
 
2
 
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
4
+import org.junit.Assert;
4
 import org.junit.Test;
5
 import org.junit.Test;
5
 
6
 
6
-import static org.junit.Assert.*;
7
-
8
 /**
7
 /**
9
  * Created by robin on 9/16/16.
8
  * Created by robin on 9/16/16.
10
  */
9
  */
16
         ServerApplication app = getServer();
15
         ServerApplication app = getServer();
17
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
16
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
18
                 "lecture#test#publicInt");
17
                 "lecture#test#publicInt");
19
-        assertEquals("42", res);
18
+        Assert.assertEquals("42", res);
20
     }
19
     }
21
 
20
 
22
     @Test
21
     @Test
25
         ServerApplication app = getServer();
24
         ServerApplication app = getServer();
26
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
25
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
27
                 "lecture#test#privateInt");
26
                 "lecture#test#privateInt");
28
-        assertEquals("24", res);
27
+        Assert.assertEquals("24", res);
29
     }
28
     }
30
 
29
 
31
     @Test
30
     @Test
34
         ServerApplication app = getServer();
33
         ServerApplication app = getServer();
35
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
34
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
36
                 "lecture#test#privateString");
35
                 "lecture#test#privateString");
37
-        assertEquals("default_value", res);
36
+        Assert.assertEquals("default_value", res);
38
     }
37
     }
39
 
38
 
40
     @Test(expected = NoSuchMethodException.class)
39
     @Test(expected = NoSuchMethodException.class)
59
         ServerApplication app = getServer();
58
         ServerApplication app = getServer();
60
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
59
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
61
                 "lecture#test#publicFloat");
60
                 "lecture#test#publicFloat");
62
-        assertEquals("0.42", res);
61
+        Assert.assertEquals("0.42", res);
63
     }
62
     }
64
 
63
 
65
     @Test
64
     @Test
68
         ServerApplication app = getServer();
67
         ServerApplication app = getServer();
69
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
68
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
70
                 "lecture#test#publicDouble");
69
                 "lecture#test#publicDouble");
71
-        assertEquals("0.125", res);
70
+        Assert.assertEquals("0.125", res);
72
     }
71
     }
73
 
72
 
74
     @Test
73
     @Test
77
         ServerApplication app = getServer();
76
         ServerApplication app = getServer();
78
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
77
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
79
                 "lecture#test#publicBool");
78
                 "lecture#test#publicBool");
80
-        assertEquals("true", res);
79
+        Assert.assertEquals("true", res);
81
     }
80
     }
82
 }
81
 }

server/src/test/java/com/uqac/rthoni/java_rmi/server/executors/TestDbo.java → src/test/java/com/uqac/rthoni/java_rmi/server/executors/TestDbo.java View File


server/src/test/java/com/uqac/rthoni/java_rmi/server/executors/WriteExecutorTest.java → src/test/java/com/uqac/rthoni/java_rmi/server/executors/WriteExecutorTest.java View File

1
 package com.uqac.rthoni.java_rmi.server.executors;
1
 package com.uqac.rthoni.java_rmi.server.executors;
2
 
2
 
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
3
 import com.uqac.rthoni.java_rmi.server.ServerApplication;
4
+import org.junit.Assert;
4
 import org.junit.Test;
5
 import org.junit.Test;
5
 
6
 
6
-import static org.junit.Assert.*;
7
-
8
 /**
7
 /**
9
  * Created by robin on 9/16/16.
8
  * Created by robin on 9/16/16.
10
  */
9
  */
17
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
16
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
18
                 "ecriture#test#publicInt#24",
17
                 "ecriture#test#publicInt#24",
19
                 "lecture#test#publicInt");
18
                 "lecture#test#publicInt");
20
-        assertEquals(res, "24");
19
+        Assert.assertEquals(res, "24");
21
         Object obj = app.getObject("test");
20
         Object obj = app.getObject("test");
22
-        assertNotNull(obj);
23
-        assertEquals("privateString=default_value, privateInt=24, publicInt=24, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true", obj.toString());
21
+        Assert.assertNotNull(obj);
22
+        Assert.assertEquals("privateString=default_value, privateInt=24, publicInt=24, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true", obj.toString());
24
     }
23
     }
25
 
24
 
26
     @Test
25
     @Test
30
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
29
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
31
                 "ecriture#test#privateInt#42",
30
                 "ecriture#test#privateInt#42",
32
                 "lecture#test#privateInt");
31
                 "lecture#test#privateInt");
33
-        assertEquals(res, "42");
32
+        Assert.assertEquals(res, "42");
34
         Object obj = app.getObject("test");
33
         Object obj = app.getObject("test");
35
-        assertNotNull(obj);
36
-        assertEquals("privateString=default_value, privateInt=42, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true", obj.toString());
34
+        Assert.assertNotNull(obj);
35
+        Assert.assertEquals("privateString=default_value, privateInt=42, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true", obj.toString());
37
     }
36
     }
38
 
37
 
39
     @Test
38
     @Test
43
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
42
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
44
                 "ecriture#test#privateString#a_value",
43
                 "ecriture#test#privateString#a_value",
45
                 "lecture#test#privateString");
44
                 "lecture#test#privateString");
46
-        assertEquals(res, "a_value");
45
+        Assert.assertEquals(res, "a_value");
47
         Object obj = app.getObject("test");
46
         Object obj = app.getObject("test");
48
-        assertNotNull(obj);
49
-        assertEquals("privateString=a_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true", obj.toString());
47
+        Assert.assertNotNull(obj);
48
+        Assert.assertEquals("privateString=a_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=true", obj.toString());
50
     }
49
     }
51
 
50
 
52
     @Test
51
     @Test
56
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
55
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
57
                 "ecriture#test#publicFloat#4242.5",
56
                 "ecriture#test#publicFloat#4242.5",
58
                 "lecture#test#publicFloat");
57
                 "lecture#test#publicFloat");
59
-        assertEquals(res, "4242.5");
58
+        Assert.assertEquals(res, "4242.5");
60
         Object obj = app.getObject("test");
59
         Object obj = app.getObject("test");
61
-        assertNotNull(obj);
62
-        assertEquals("privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=4242.500000, publicDouble=0.125000, publicBool=true", obj.toString());
60
+        Assert.assertNotNull(obj);
61
+        Assert.assertEquals("privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=4242.500000, publicDouble=0.125000, publicBool=true", obj.toString());
63
     }
62
     }
64
 
63
 
65
     @Test
64
     @Test
69
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
68
         String res = runCommands(app, "creation#com.uqac.rthoni.java_rmi.server.executors.TestDbo#test",
70
                 "ecriture#test#publicBool#false",
69
                 "ecriture#test#publicBool#false",
71
                 "lecture#test#publicBool");
70
                 "lecture#test#publicBool");
72
-        assertEquals(res, "false");
71
+        Assert.assertEquals(res, "false");
73
         Object obj = app.getObject("test");
72
         Object obj = app.getObject("test");
74
-        assertNotNull(obj);
75
-        assertEquals("privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=false", obj.toString());
73
+        Assert.assertNotNull(obj);
74
+        Assert.assertEquals("privateString=default_value, privateInt=24, publicInt=42, aPrivateField=0, publicFloat=0.420000, publicDouble=0.125000, publicBool=false", obj.toString());
76
     }
75
     }
77
 }
76
 }

+ 2
- 3
uqac-java-rmi.iml View File

11
     </content>
11
     </content>
12
     <orderEntry type="inheritedJdk" />
12
     <orderEntry type="inheritedJdk" />
13
     <orderEntry type="sourceFolder" forTests="false" />
13
     <orderEntry type="sourceFolder" forTests="false" />
14
-    <orderEntry type="module" module-name="client" />
15
-    <orderEntry type="module" module-name="common" />
16
-    <orderEntry type="module" module-name="server" />
14
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
15
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
17
   </component>
16
   </component>
18
 </module>
17
 </module>

Loading…
Cancel
Save