Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5680 Renamed example jar resource. #5717

Merged
merged 1 commit into from
Jul 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 44 additions & 16 deletions doc/contents/GroovyAddJarToClasspathMagicCommands.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"metadata": {},
"outputs": [],
"source": [
"import com.beakerx.BeakerxObject"
"import com.example.Demo"
]
},
{
Expand All @@ -30,10 +30,39 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%classpath add jar demoResources/beakerxTestLibrary.jar"
"%classpath add jar demoResources/demo.jar"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Source code of Demo class\n",
"\n",
"```java\n",
"package com.example;\n",
"\n",
"public class Demo {\n",
" public static final String OBJECT_TEST_123 = \"Demo_test_123\";\n",
" public static final String STATIC_TEST_123 = \"Demo_static_test_123\";\n",
"\n",
" public Demo() {\n",
" }\n",
"\n",
" public static String staticTest() {\n",
" return \"Demo_static_test_123\";\n",
" }\n",
"\n",
" public String getObjectTest() {\n",
" return \"Demo_test_123\";\n",
" }\n",
"}\n",
"```"
]
},
{
Expand All @@ -49,7 +78,7 @@
"metadata": {},
"outputs": [],
"source": [
"import com.beakerx.BeakerxObject"
"import com.example.Demo"
]
},
{
Expand All @@ -58,10 +87,9 @@
"metadata": {},
"outputs": [],
"source": [
"%classpath add jar demoResources/beakerxTestLibrary.jar\n",
"import com.beakerx.BeakerxObject\n",
"BeakerxObject beakerxObject = new BeakerxObject();\n",
"println beakerxObject.getObjectTest()"
"import com.example.Demo\n",
"Demo demo = new Demo();\n",
"println demo.getObjectTest()"
]
},
{
Expand All @@ -77,16 +105,16 @@
"metadata": {},
"outputs": [],
"source": [
"%classpath add jar demoResources/beakerxTestLibrary.jar\n",
"%classpath add jar demoResources/demo.jar\n",
"%classpath add jar demoResources/BeakerXClasspathTest.jar\n",
"\n",
"println com.beakerx.BeakerxObject.staticTest();\n",
"println com.example.Demo.staticTest();\n",
"\n",
"import com.twosigma.beakerx.jvm.object.OutputCell\n",
"import com.beakerx.BeakerxObject\n",
"import com.example.Demo\n",
"\n",
"BeakerxObject beakerxObject = new BeakerxObject();\n",
"println beakerxObject.getObjectTest()\n",
"Demo demo = new Demo();\n",
"println demo.getObjectTest()\n",
"\n",
"import com.beaker.BeakerXClasspathTest\n",
"BeakerXClasspathTest t = new BeakerXClasspathTest();\n",
Expand Down Expand Up @@ -178,7 +206,7 @@
"metadata": {},
"outputs": [],
"source": [
"%classpath add jar demoResources/beakerxTestLibrary.jar\n",
"%classpath add jar demoResources/demo.jar\n",
"%classpath\n",
"5+5"
]
Expand All @@ -192,7 +220,7 @@
"outputs": [],
"source": [
"%classpath\n",
"%classpath add jar demoResources/beakerxTestLibrary.jar"
"%classpath add jar demoResources/demo.jar"
]
},
{
Expand All @@ -201,7 +229,7 @@
"metadata": {},
"outputs": [],
"source": [
"%classpath add jar demoResources/beakerxTestLibrary.jar\n",
"%classpath add jar demoResources/demo.jar\n",
"%classpath"
]
},
Expand Down
4 changes: 1 addition & 3 deletions doc/contents/GroovyAutocomplete.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"metadata": {},
"outputs": [
{
"data": {
Expand Down
Binary file removed doc/contents/demoResources/beakerxTestLibrary.jar
Binary file not shown.
Binary file added doc/contents/demoResources/demo.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
public class ExecuteRequestHandlerMagicCommandTest {

public static final String DEMO_FILES_DEMO_RESOURCES_BEAKER_XCLASSPATH_TEST_JAR = "../../doc/contents/demoResources/BeakerXClasspathTest.jar";
public static final String DEMO_FILES_DEMO_RESOURCES_BEAKERX_TEST_LIBRARY_JAR = "../../doc/contents/demoResources/beakerxTestLibrary.jar";
public static final String DEMO_FILES_DEMO_RESOURCES_BEAKERX_TEST_LIBRARY_JAR = "../../doc/contents/demoResources/demo.jar";
private KernelTest kernel;
private EvaluatorTest evaluator;
private ExecuteRequestHandler executeRequestHandler;
Expand All @@ -53,9 +53,9 @@ public void handleMagicClasspathAddJarAndExecuteTheCode() throws Exception {
//given
String code = "" +
"%classpath add jar " + DEMO_FILES_DEMO_RESOURCES_BEAKER_XCLASSPATH_TEST_JAR + "\n" +
"import com.beakerx.BeakerxObject;\n" +
"BeakerxObject beakerxObject = new BeakerxObject();\n" +
"beakerxObject.getObjectTest()\n";
"import com.example.Demo;\n" +
"Demo demo = new Demo();\n" +
"demo.getObjectTest()\n";

Message magicMessage = JupyterHandlerTest.createExecuteRequestMessage(new Code(code));
//when
Expand All @@ -67,8 +67,6 @@ public void handleMagicClasspathAddJarAndExecuteTheCode() throws Exception {

@Test
public void handleMagicClasspathAddJar() throws Exception {
System.out.println("SIEMA " + System.getProperty("user.dir"));

//when
String code = "" +
"%classpath add jar " + DEMO_FILES_DEMO_RESOURCES_BEAKER_XCLASSPATH_TEST_JAR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

public class MagicCommandResultOrderTest {

public static final String DOC_CONTENTS_DEMO_RESOURCES_BEAKERX_TEST_LIBRARY_JAR = "../../doc/contents/demoResources/beakerxTestLibrary.jar";
public static final String DOC_CONTENTS_DEMO_RESOURCES_BEAKERX_TEST_LIBRARY_JAR = "../../doc/contents/demoResources/demo.jar";
private MagicCommand sut;
private KernelTest kernel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ public static void setUpClass() throws Exception {
public void addJarToClasspath() throws Exception {
//given
String code = "" +
"import com.beakerx.BeakerxObject;\n" +
"BeakerxObject beakerxObject = new BeakerxObject();\n" +
"beakerxObject.getObjectTest()\n";
"import com.example.Demo;\n" +
"Demo demo = new Demo();\n" +
"demo.getObjectTest()\n";
SimpleEvaluationObject seo = runCode(code);
assertThat(seo.getStatus()).isEqualTo(ERROR);
//when
PathToJar path = new PathToJar(SRC_TEST_RESOURCES + "beakerxTestLibrary.jar");
PathToJar path = new PathToJar(SRC_TEST_RESOURCES + "demo.jar");
groovyEvaluator.addJarToClasspath(path);
//then
SimpleEvaluationObject seo2 = runCode(code);
assertThat(seo2.getStatus()).isEqualTo(FINISHED);
assertThat(seo2.getPayload()).isEqualTo("BeakerxObject_test_123");
assertThat(seo2.getPayload()).isEqualTo("Demo_test_123");
}

private SimpleEvaluationObject runCode(String code) throws InterruptedException {
Expand Down
Binary file removed kernel/groovy/src/test/resources/beakerxTestLibrary.jar
Binary file not shown.
Binary file added kernel/groovy/src/test/resources/demo.jar
Binary file not shown.