[jira] [Comment Edited] (BEAM-298) Make TestPipeline implement the TestRule interface

2017-02-11 Thread Stas Levin (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862327#comment-15862327
 ] 

Stas Levin edited comment on BEAM-298 at 2/11/17 11:40 AM:
---

After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a 
{{provided}} dependency, which makes it availiable in compile and test scopes 
^1^ (since it has both compile and test scope needs for {{junit}}).

Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get 
{{junit}} due to maven's transitive dependency rules ^1^, so they need to 
explicitly declare their dependency on {{junit}} in either the {{provided}} or 
{{test}} scope, according to their needs.

If you do not have a compile time dependency on {{junit}} (which I assume is 
the case since your code probably compiles and the error you describe is a 
runtime one), I would expect the addition of a {{test}} scope dependency to fix 
the problem. Since it doesn't, I'm tempted to believe you're using the 
{{TestPipeline}} in a *non*-{{test}} scope, where {{junit}} can indeed be 
missing from the classpath ^2^.

Could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?

1. 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
2. Or I could be completely wrong and the problem lies elsewhere.


was (Author: staslev):
After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a 
{{provided}} dependency, which makes it availiable in compile and test scopes 
^1^ (since it has both compile and test scope needs for {{junit}}).

Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get 
{{junit}} due to maven's transitive dependency rules ^1^, so they need to 
explicitly declare their dependency on {{junit}} in either the {{provided}} or 
{{test}} scope, according to their needs.

If you do not have a compile time dependency on {{junit}} (which I assume is 
the case since your code probably compiles and the error you describe is a 
runtime one), I would expect the addition of a {{test}} scope dependency to fix 
the problem. Since it doesn't, I'm tempted to believe you're using the 
{{TestPipeline}} in a non {{test}} scope, where {{junit}} can indeed be missing 
from the classpath ^2^.

Could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?

1. 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
2. Or I could be completely wrong and the problem lies elsewhere.

> Make TestPipeline implement the TestRule interface
> --
>
> Key: BEAM-298
> URL: https://issues.apache.org/jira/browse/BEAM-298
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Thomas Groh
>Assignee: Stas Levin
>Priority: Minor
> Fix For: 0.5.0
>
>
> https://github.com/junit-team/junit4/wiki/Rules
> A JUnit Rule allows a test to use a field annotated with @Rule to wrap 
> executing tests. Doing so allows the TestPipeline to, at the time the test 
> completes, assert that all applied transforms have been executed. This 
> ensures that all unit tests that utilize a TestPipeline rule either are 
> declared to explicitly not expect to execute or have executed the pipeline.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (BEAM-298) Make TestPipeline implement the TestRule interface

2017-02-11 Thread Stas Levin (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862327#comment-15862327
 ] 

Stas Levin edited comment on BEAM-298 at 2/11/17 11:39 AM:
---

After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a 
{{provided}} dependency, which makes it availiable in compile and test scopes 
^1^ (since it has both compile and test scope needs for {{junit}}).

Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get 
{{junit}} due to maven's transitive dependency rules ^1^, so they need to 
explicitly declare their dependency on {{junit}} in either the {{provided}} or 
{{test}} scope, according to their needs.

If you do not have a compile time dependency on {{junit}} (which I assume is 
the case since your code probably compiles and the error you describe is a 
runtime one), I would expect the addition of a {{test}} scope dependency to fix 
the problem. Since it doesn't, I'm tempted to believe you're using the 
{{TestPipeline}} in a non {{test}} scope, where {{junit}} can indeed be missing 
from the classpath ^2^.

Could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?

1. 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
2. Or I could be completely wrong and the problem lies elsewhere.


was (Author: staslev):
After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a 
{{provided}} dependency, which makes it availiable in compile and test scopes 
^1^ (since it has both compile and test scope needs for {{junit}}).

Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get 
{{junit}} due to maven's transitive dependency rules ^1^, so they need to 
explicitly declare their dependency on {{junit}} in either the {{provided}} or 
{{test}} scope, according to their needs.

If you do not have a compile time dependency on {{junit}} (which I assume is 
the case since your code probably compiles and the error you describe is a 
runtime one), I would expect adding a {{test}} scope dependency to fix the 
problem. Since it doesn't, I'm tempted to believe you're using the 
{{TestPipeline}} in a non {{test}} scope, where {{junit}} can indeed be missing 
from the classpath ^2^.

Could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?

1. 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
2. Or I could be completely wrong and the problem lies elsewhere.

> Make TestPipeline implement the TestRule interface
> --
>
> Key: BEAM-298
> URL: https://issues.apache.org/jira/browse/BEAM-298
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Thomas Groh
>Assignee: Stas Levin
>Priority: Minor
> Fix For: 0.5.0
>
>
> https://github.com/junit-team/junit4/wiki/Rules
> A JUnit Rule allows a test to use a field annotated with @Rule to wrap 
> executing tests. Doing so allows the TestPipeline to, at the time the test 
> completes, assert that all applied transforms have been executed. This 
> ensures that all unit tests that utilize a TestPipeline rule either are 
> declared to explicitly not expect to execute or have executed the pipeline.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (BEAM-298) Make TestPipeline implement the TestRule interface

2017-02-11 Thread Stas Levin (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862327#comment-15862327
 ] 

Stas Levin edited comment on BEAM-298 at 2/11/17 10:30 AM:
---

After taking a deeper look, {{beam-sdks-java-core}} declares {{junit}} as a 
{{provided}} dependency, which makes it availiable in compile and test scopes 
^1^ (since it has both compile and test scope needs for {{junit}}).

Modules that depend on {{beam-sdks-java-core}} in {{compile}} scope do not get 
{{junit}} due to maven's transitive dependency rules ^1^, so they need to 
explicitly declare their dependency on {{junit}} in either the {{provided}} or 
{{test}} scope, according to their needs.

If you do not have a compile time dependency on {{junit}} (which I assume is 
the case since your code probably compiles and the error you describe is a 
runtime one), I would expect adding a {{test}} scope dependency to fix the 
problem. Since it doesn't, I'm tempted to believe you're using the 
{{TestPipeline}} in a non {{test}} scope, where {{junit}} can indeed be missing 
from the classpath ^2^.

Could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?

1. 
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
2. Or I could be completely wrong and the problem lies elsewhere.


was (Author: staslev):
You're right, test scope seems to fall short since {{TestPipeline}} is part of 
the production code API.
Let me take a deeper look a it.

Meanwhile, could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?

> Make TestPipeline implement the TestRule interface
> --
>
> Key: BEAM-298
> URL: https://issues.apache.org/jira/browse/BEAM-298
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Thomas Groh
>Assignee: Stas Levin
>Priority: Minor
> Fix For: 0.5.0
>
>
> https://github.com/junit-team/junit4/wiki/Rules
> A JUnit Rule allows a test to use a field annotated with @Rule to wrap 
> executing tests. Doing so allows the TestPipeline to, at the time the test 
> completes, assert that all applied transforms have been executed. This 
> ensures that all unit tests that utilize a TestPipeline rule either are 
> declared to explicitly not expect to execute or have executed the pipeline.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (BEAM-298) Make TestPipeline implement the TestRule interface

2017-02-11 Thread Stas Levin (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862327#comment-15862327
 ] 

Stas Levin edited comment on BEAM-298 at 2/11/17 9:23 AM:
--

You're right, test scope seems to fall short since {{TestPipeline}} is part of 
the production code API.
Let me take a deeper look a it.

Meanwhile, could you please provide some more info regarding your scenario? 
Are you running {{TestPipeline}} as part of a unit test or production code on 
your end?


was (Author: staslev):
Could you please provide some more info regarding your scenario and how I can 
reproduce it?
Are you running {{TestPipeline}} as part of a unit test or production code? 

> Make TestPipeline implement the TestRule interface
> --
>
> Key: BEAM-298
> URL: https://issues.apache.org/jira/browse/BEAM-298
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Thomas Groh
>Assignee: Stas Levin
>Priority: Minor
> Fix For: 0.5.0
>
>
> https://github.com/junit-team/junit4/wiki/Rules
> A JUnit Rule allows a test to use a field annotated with @Rule to wrap 
> executing tests. Doing so allows the TestPipeline to, at the time the test 
> completes, assert that all applied transforms have been executed. This 
> ensures that all unit tests that utilize a TestPipeline rule either are 
> declared to explicitly not expect to execute or have executed the pipeline.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (BEAM-298) Make TestPipeline implement the TestRule interface

2017-02-10 Thread Neville Li (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15862201#comment-15862201
 ] 

Neville Li edited comment on BEAM-298 at 2/11/17 4:12 AM:
--

That didn't work for me. I had to add it as a {{compile}} scope.


was (Author: sinisa_lyh):
That didn't work for me. I had to add it as a {compile} scope.

> Make TestPipeline implement the TestRule interface
> --
>
> Key: BEAM-298
> URL: https://issues.apache.org/jira/browse/BEAM-298
> Project: Beam
>  Issue Type: Improvement
>  Components: sdk-java-core
>Reporter: Thomas Groh
>Assignee: Stas Levin
>Priority: Minor
> Fix For: 0.5.0
>
>
> https://github.com/junit-team/junit4/wiki/Rules
> A JUnit Rule allows a test to use a field annotated with @Rule to wrap 
> executing tests. Doing so allows the TestPipeline to, at the time the test 
> completes, assert that all applied transforms have been executed. This 
> ensures that all unit tests that utilize a TestPipeline rule either are 
> declared to explicitly not expect to execute or have executed the pipeline.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Comment Edited] (BEAM-298) Make TestPipeline implement the TestRule interface

2017-02-10 Thread Neville Li (JIRA)

[ 
https://issues.apache.org/jira/browse/BEAM-298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15861795#comment-15861795
 ] 

Neville Li edited comment on BEAM-298 at 2/10/17 8:08 PM:
--

As a result of this change I need to include {{junit}} in my dependencies or 
it'll fail with a class not found exception. Is this expected?

{code}
java.lang.NoClassDefFoundError: org/junit/rules/TestRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.spotify.scio.ContextAndArgs$.apply(ScioContext.scala:65)
at 
com.spotify.scio.examples.MinimalWordCount$.main(MinimalWordCount.scala:35)
at 
com.spotify.scio.examples.MinimalWordCount.main(MinimalWordCount.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.Run.invokeMain(Run.scala:67)
at sbt.Run.run0(Run.scala:61)
at sbt.Run.sbt$Run$$execute$1(Run.scala:51)
at sbt.Run$$anonfun$run$1.apply$mcV$sp(Run.scala:55)
at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
at sbt.Logger$$anon$4.apply(Logger.scala:84)
at sbt.TrapExit$App.run(TrapExit.scala:248)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.junit.rules.TestRule
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
{code}


was (Author: sinisa_lyh):
As a result of this change I need to include {{junit}} in my dependencies or 
it'll fail with a class not found exception. Is this expected?

{{
java.lang.NoClassDefFoundError: org/junit/rules/TestRule
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.spotify.scio.ContextAndArgs$.apply(ScioContext.scala:65)
at 
com.spotify.scio.examples.MinimalWordCount$.main(MinimalWordCount.scala:35)
at 
com.spotify.scio.examples.MinimalWordCount.main(MinimalWordCount.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.Run.invokeMain(Run.scala:67)
at sbt.Run.run0(Run.scala:61)
at sbt.Run.sbt$Run$$execute$1(Run.scala:51)
at sbt.Run$$anonfun$run$1.apply$mcV$sp(Run.scala:55)
at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
at sbt.Run$$anonfun$run$1.apply(Run.scala:55)
at sbt.Logger$$anon$4.apply(Logger.scala:84)
at sbt.TrapExit$App.run(TrapExit.scala:248)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.junit.rules.TestRule
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
}}

> Make TestPipeline implement the TestRule interface
> --
>
> Key: BEAM-298
> URL: https: