forked from Stratio/crossdata
-
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.
[CROSSDATA-733] Query Cancellation: HTTP + ClusterClient (Stratio#767)
* Working cancellations through HTTP * Query cancellation for ClusterClient and HTTP Client with tests * Added license * Fix: BasicShell wasn't flushing IO buffers in async mode. * Added changelog * Snippet style change. * Fixed file location * Changed test name so it gets processed by CD * Added derby abrupt termination guard
- Loading branch information
1 parent
f6f4c0d
commit d61c01e
Showing
11 changed files
with
124 additions
and
56 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
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
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
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
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
65 changes: 65 additions & 0 deletions
65
testsIT/src/test/scala/com/stratio/crossdata/driver/DriverQueryManagementIT.scala
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,65 @@ | ||
/* | ||
* Copyright (C) 2015 Stratio (http://stratio.com) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.stratio.crossdata.driver | ||
|
||
import java.nio.file.Paths | ||
|
||
import com.stratio.crossdata.common.QueryCancelledReply | ||
import com.stratio.crossdata.common.result.ErrorSQLResult | ||
import com.stratio.crossdata.driver.test.Utils._ | ||
import org.junit.runner.RunWith | ||
import org.scalatest.concurrent.ScalaFutures | ||
import org.scalatest.junit.JUnitRunner | ||
|
||
import scala.concurrent.duration._ | ||
import scala.util.Try | ||
|
||
@RunWith(classOf[JUnitRunner]) | ||
class DriverQueryManagementIT extends EndToEndTest with ScalaFutures { | ||
|
||
driverFactories foreach { case (factory, description) => | ||
|
||
implicit val ctx = DriverTestContext(factory) | ||
|
||
val factoryDesc = s" $description" | ||
|
||
"CrossdataDriver" should "be able to cancel queries" + factoryDesc in { | ||
assumeCrossdataUpAndRunning() | ||
|
||
withDriverDo { driver => | ||
|
||
driver.sql(s"CREATE TEMPORARY TABLE jsonTable2 USING org.apache.spark.sql.json OPTIONS (path '${Paths.get (getClass.getResource("/tabletest.json").toURI).toString}')").waitForResult() | ||
|
||
val queryRq = driver.sql("SELECT DEBUG_SLEEP_MS(5000) FROM jsonTable2") | ||
val cancellationResponseFuture = queryRq.cancelCommand() | ||
|
||
whenReady(cancellationResponseFuture) { res => | ||
res shouldBe a[QueryCancelledReply] | ||
} (PatienceConfig(timeout = 2 seconds)) | ||
|
||
whenReady(queryRq.sqlResult) { sqlResult => | ||
sqlResult shouldBe a[ErrorSQLResult] | ||
} (PatienceConfig(timeout = 3 seconds)) | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
override def stop(): Unit = Try(super.stop()) //TODO | ||
|
||
} |