[
https://issues.jboss.org/browse/ARQGRA-461?page=com.atlassian.jira.plugin...
]
Alex Soto commented on ARQGRA-461:
----------------------------------
Well in my case I can run with stream because there is no problem at all. But I have tried
to calculate it and I have found this exception and I decided to report it.
Maybe you can close it, but at least if anyone find the same exception in near future, the
"solution" is documented somewhere.
Running Graphene tests and use parallelStream method makes test fail
with java.lang.IllegalStateException: The Graphene runtime isn't initialized.
Exception.
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: ARQGRA-461
URL:
https://issues.jboss.org/browse/ARQGRA-461
Project: Arquillian Graphene
Issue Type: Bug
Reporter: Alex Soto
Priority: Minor
Labels: java8,, threads
Running Graphene tests and use parallelStream method makes test fail with
java.lang.IllegalStateException: The Graphene runtime isn't initialized. Exception.
Basically the problem is when you want to get information about tables. You can iterate
over elements in a foreach fashion, but you can also use new Java 8 stream API.
This works:
ession.findElements(xpath("//table/tbody/tr/td/span[@class='title']")).stream().map(WebElement::getText).collect(Collectors.toList());
But if table is big you will try to improve parsing speed by adding parallelSteam
(session.findElements(xpath("//table/tbody/tr/td/span[@class='title']")).parallelStream().map(WebElement::getText).collect(Collectors.toList());)
And in this case an exception is thrown.
Internally parallelStream uses a pool of threads so probably Graphene instance is tight
to thread of test case, so the threads used by parallelStream does not contains a valid
instance of Graphene.
Of course this is not blocking nor a big problem in the sense that you can use stream()
without any problem, and moreover Java 8 is not spread yet, but it may be a problem in the
future.
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)