forked from robotframework/jrobotremoteserver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue robotframework#65: Fix get_library_information when called mult…
…iple times Also extends tests to cover this behaviour.
- Loading branch information
1 parent
82f904d
commit e993ba0
Showing
4 changed files
with
71 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/test/java/org/robotframework/examplelib/FullDynamicTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.robotframework.examplelib; | ||
|
||
import java.io.IOException; | ||
import java.util.Map; | ||
|
||
import javax.servlet.ServletException; | ||
|
||
import org.robotframework.remoteserver.servlet.ServerMethods; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
public class FullDynamicTest { | ||
|
||
|
||
@Test | ||
public void testCallingTwice() throws IOException, ServletException { | ||
FullDynamic dynamic = new FullDynamic(); | ||
SimpleRemoteServerServlet servlet = new SimpleRemoteServerServlet(dynamic.getLib()); | ||
ServerMethods methods = new ServerMethods(servlet); | ||
|
||
Map<String, Object> map1 = methods.get_library_information(); | ||
Map<String, Object> map2 = methods.get_library_information(); | ||
// The exact count we don't care about. | ||
// We just want the information to stay consistent. | ||
Assert.assertEquals(map1.size(), map2.size()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/test/java/org/robotframework/examplelib/SimpleRemoteServerServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.robotframework.examplelib; | ||
|
||
import org.robotframework.javalib.library.AnnotationLibrary; | ||
import org.robotframework.remoteserver.library.RemoteLibrary; | ||
import org.robotframework.remoteserver.library.RemoteLibraryFactory; | ||
import org.robotframework.remoteserver.servlet.RemoteServerServlet; | ||
|
||
public class SimpleRemoteServerServlet extends RemoteServerServlet { | ||
|
||
private static final long serialVersionUID = -2729050484180284488L; | ||
private final RemoteLibrary library; | ||
|
||
public SimpleRemoteServerServlet(AnnotationLibrary library) { | ||
RemoteLibraryFactory libraryFactory = createLibraryFactory(); | ||
RemoteLibrary remoteLibrary = libraryFactory.createRemoteLibrary(library); | ||
this.library = remoteLibrary; | ||
} | ||
|
||
public RemoteLibrary getLibrary() { | ||
return this.library; | ||
} | ||
} |