Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d6bab3c
[CROSSDATA] [CONFIG] Pom files with parent and artifactId to fixed Sc…
mafernandez-stratio May 3, 2016
61fc6f1
Merge branch 'master' of https://github.com/stratio/crossdata into po…
mafernandez-stratio May 3, 2016
844f5ed
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 7, 2016
bb7d85a
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 9, 2016
d2d9ff8
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 13, 2016
8e2af54
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 18, 2016
004b34c
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 19, 2016
28dc3a7
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 23, 2016
eff4b91
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 25, 2016
d792133
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 25, 2016
a70434d
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio May 30, 2016
d4064c5
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 2, 2016
f6df567
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 6, 2016
946c91a
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 7, 2016
bab40dc
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 7, 2016
157b18a
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 8, 2016
700cf6b
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 13, 2016
fdd5d2a
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 16, 2016
0ea43f5
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 16, 2016
9fcc66f
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 20, 2016
8849191
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 22, 2016
24ee629
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jun 24, 2016
17118eb
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Jul 4, 2016
974729a
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Aug 3, 2016
6887514
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Sep 5, 2016
0f55eca
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Sep 8, 2016
b04eacf
Merge branch 'master' of https://github.com/stratio/crossdata
mafernandez-stratio Sep 9, 2016
666cbab
[CROSSDATA-577] Service discovery: test skeleton
mafernandez-stratio Sep 9, 2016
15e4f6e
[CROSSDATA-577] Service discovery: Adding integration test
mafernandez-stratio Sep 11, 2016
3b2a289
[CROSSDATA-577] Service discovery: Integration test
mafernandez-stratio Sep 11, 2016
9d34fbc
Merge branch 'master' of https://github.com/stratio/crossdata into CR…
mafernandez-stratio Sep 11, 2016
6e7eee9
[CROSSDATA-577] Service discovery: Problem in test fixed
mafernandez-stratio Sep 11, 2016
d21ee2d
[CROSSDATA-577] Service discovery: Improvements in test
mafernandez-stratio Sep 11, 2016
f2c0783
[CROSSDATA-577] Service discovery: Avoid endless beforeAll
mafernandez-stratio Sep 11, 2016
cc8e0b1
Merge branch 'branch-1.6' of https://github.com/stratio/crossdata int…
mafernandez-stratio Sep 16, 2016
45d0784
[CROSSDATA-577] Service discovery: Integration test - Compilation err…
mafernandez-stratio Sep 16, 2016
80282cf
[CROSSDATA] Crossdata versions up-to-date
mafernandez-stratio Sep 17, 2016
3b626c4
[CROSSDATA-577] Service discovery: Integration test - Avoiding endles…
mafernandez-stratio Sep 17, 2016
b29e5df
[CROSSDATA-577] Service discovery: Integration test - Using CD ZK
mafernandez-stratio Sep 19, 2016
452a824
[CROSSDATA-577] Service discovery: Integration test - Execution Conte…
mafernandez-stratio Sep 19, 2016
5401004
[CROSSDATA-577] Service discovery: Integration test - Execution Conte…
mafernandez-stratio Sep 19, 2016
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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ Spark Compatibility

| Crossdata Version | Spark Version |
|-------------------|:--------------|
| 1.6.X | 1.6.X |
| 1.5.X | 1.6.X |
| 1.4.X | 1.6.X |
| 1.3.X | 1.6.X |
| 1.2.X | 1.5.X |
| 1.1.X | 1.5.X |
| 1.0.X | 1.5.X |
| 1.2.X | 1.5.X |
| 1.1.X | 1.5.X |
| 1.0.X | 1.5.X |


=============
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Try}


class CrossdataServer(progrConfig: Option[Config] = None) extends ServerConfig {
class CrossdataServer(progrConfig: Option[Config] = None, hzMembers: Option[Set[String]] = None) extends ServerConfig {

override lazy val logger = Logger.getLogger(classOf[CrossdataServer])

Expand All @@ -55,7 +55,20 @@ class CrossdataServer(progrConfig: Option[Config] = None) extends ServerConfig {

private val serverConfig = progrConfig map (_.withFallback(config)) getOrElse (config)

private val hzConfig: HzConfig = new XmlConfigBuilder().build()
private val hzConfig: HzConfig = {
val baseConfig = new XmlConfigBuilder().build()
hzMembers map { members =>
insertHzMembers(baseConfig, members)
} getOrElse {
baseConfig
}
}

private def insertHzMembers(hConfig: HzConfig, members: Set[String]) =
hConfig.setNetworkConfig(
hConfig.getNetworkConfig.setJoin(
hConfig.getNetworkConfig.getJoin.setTcpIpConfig(
hConfig.getNetworkConfig.getJoin.getTcpIpConfig.setMembers(members.toList))))

private def startDiscoveryClient(sdConfig: SDCH): CuratorFramework = {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* 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.server

import java.util.concurrent.Executors

import com.stratio.crossdata.server.discovery.ServiceDiscoveryConfigHelper
import com.stratio.crossdata.test.BaseXDTest
import com.typesafe.config.{ConfigFactory, ConfigValueFactory}
import org.apache.curator.framework.CuratorFrameworkFactory
import org.apache.curator.retry.ExponentialBackoffRetry
import org.junit.runner.RunWith
import org.scalatest.BeforeAndAfterAll
import org.scalatest.junit.JUnitRunner

import scala.concurrent.{Await, ExecutionContext, Future}
import scala.concurrent.duration._
import scala.util.Try

@RunWith(classOf[JUnitRunner])
class ServiceDiscoveryIT extends BaseXDTest with BeforeAndAfterAll {

import ServiceDiscoveryConstants._

val ZookeeperStreamingConnectionKey = "streaming.catalog.zookeeper.connectionString"
val ZookeeperConnection: Option[String] =
Try(ConfigFactory.load().getString(ZookeeperStreamingConnectionKey)).toOption

var testServer: CrossdataServer = _

implicit val executionContext = ExecutionContext.fromExecutor(Executors.newFixedThreadPool(8))

override def beforeAll(): Unit = {

val testConfig = ConfigFactory.empty
.withValue("akka.remote.netty.tcp.hostname", ConfigValueFactory.fromAnyRef(TestHost))
.withValue("akka.remote.netty.tcp.port", ConfigValueFactory.fromAnyRef(AkkaPort))
.withValue("service-discovery.activated", ConfigValueFactory.fromAnyRef(true))
.withValue(
"config.spark.jars",
ConfigValueFactory.fromAnyRef(s"server/target/2.11/crossdata-server-jar-with-dependencies.jar"))

testServer = Await.result(Future(new CrossdataServer(Some(testConfig), Some(Set(s"$TestHost:$HzPort")))), 2 minutes)

Await.result(Future(testServer.start), 2 minutes)
}

override def afterAll(): Unit = {
Await.result(Future(testServer.stop), 2 minutes)
}

"A Crossdata Server" should "write its hostname:port in ZK when service discovery is activated" in {

ZookeeperConnection.isDefined should be (true)

val curatorClient = CuratorFrameworkFactory.newClient(
ZookeeperConnection.get,
new ExponentialBackoffRetry(1000, 3))
curatorClient.blockUntilConnected
val currentSeeds = new String(curatorClient.getData.forPath(ServiceDiscoveryConfigHelper.DefaultSeedsPath))

currentSeeds should be (s"$TestHost:$AkkaPort")

val currentMembers = new String(curatorClient.getData.forPath(ServiceDiscoveryConfigHelper.DefaultProviderPath))

currentMembers should be (s"$TestHost:$HzPort")
}

}

object ServiceDiscoveryConstants {
val TestHost = "127.0.0.1"
val AkkaPort = 13456
val HzPort = 5789
}