当前位置: 首页>>代码示例>>Scala>>正文


Scala ExecutionEnv类代码示例

本文整理汇总了Scala中org.specs2.concurrent.ExecutionEnv的典型用法代码示例。如果您正苦于以下问题:Scala ExecutionEnv类的具体用法?Scala ExecutionEnv怎么用?Scala ExecutionEnv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ExecutionEnv类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: ListMetricNamesSpec

//设置package包名称以及导入依赖的类
package unit

import io.waylay.kairosdb.driver.KairosDB
import io.waylay.kairosdb.driver.models._
import mockws.MockWS
import org.specs2.mutable.Specification
import play.api.libs.json.Json
import play.api.mvc.Action
import play.api.mvc.Results._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.matcher.{FutureMatchers, ResultMatchers}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

class ListMetricNamesSpec extends Specification with FutureMatchers with ResultMatchers {
  "KairosDB#listMetricNames" should {
    "return the correct metric names" in { implicit ee: ExecutionEnv =>
      val expected = Seq("mymetric", "archive_file_search", "bar1")

      val mockWs = MockWS {
        case ("GET", "http://localhost:8080/api/v1/metricnames") => Action {
          Ok(Json.obj("results" -> expected))
        }
      }

      val kairosDb = new KairosDB(StandaloneMockWs(mockWs), KairosDBConfig(), global)

      val r = kairosDb.listMetricNames must be_==(expected.map(MetricName)).await(1, 3.seconds)
      mockWs.close()
      r
    }
  }
} 
开发者ID:waylayio,项目名称:kairosdb-scala,代码行数:35,代码来源:ListMetricNamesSpec.scala

示例2: PaginatedResponseRetrieverSpec

//设置package包名称以及导入依赖的类
package com.dwolla.awssdk.utils

import com.amazonaws.services.ecs.AmazonECSAsync
import com.amazonaws.services.ecs.model.{ListClustersRequest, ListClustersResult, ListContainerInstancesRequest, ListContainerInstancesResult}
import com.dwolla.awssdk.AmazonAsyncMockingImplicits._
import com.dwolla.awssdk.utils.PaginatedResponseRetriever._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mock.Mockito
import org.specs2.mutable.Specification
import org.specs2.specification.Scope

import scala.collection.JavaConverters._

class PaginatedResponseRetrieverSpec(implicit ee: ExecutionEnv) extends Specification with Mockito {

  trait Setup extends Scope {
    val mockEcsClient = mock[AmazonECSAsync]
  }

  "PaginatedResponseRetriever" should {
    "make all the requests necessary to fetch all paginated results" in new Setup {
      def reqWithNextToken(x: Option[Int]) = new ListContainerInstancesRequest().withCluster("cluster1").withNextToken(x.map(i ? s"next-token-$i").orNull)

      def res(x: Int, y: Option[Int] = None) = Right(new ListContainerInstancesResult().withContainerInstanceArns(s"arn$x").withNextToken(y.map(i ? s"next-token-$i").orNull))

      val pages = 1 to 50
      val pairs = pages.sliding(2).toSeq.map {
        case Vector(1, y) ? reqWithNextToken(None) ? res(1, Option(y))
        case Vector(x, y) if x > 1 && y < pages.last ? reqWithNextToken(Option(x)) ? res(x, Option(y))
        case Vector(x, _) ? reqWithNextToken(Option(x)) ? res(x, None)
      }

      mockedMethod(mockEcsClient.listContainerInstancesAsync) answers (pairs: _*)

      val output = fetchAll(() ? new ListContainerInstancesRequest().withCluster("cluster1"),mockEcsClient.listContainerInstancesAsync)
        .map(_.flatMap(_.getContainerInstanceArns.asScala.toList))

      output must containTheSameElementsAs(pages.dropRight(1).map(x ? s"arn$x")).await
    }

    "support default request factory" in new Setup {
      new ListClustersResult() completes mockEcsClient.listClustersAsync

      val output = fetchAllWithDefaultRequestsVia(mockEcsClient.listClustersAsync)

      output must contain(new ListClustersResult()).await
    }

    "support builder syntax with factory as initial parameter" in new Setup {
      new ListClustersResult() completes mockEcsClient.listClustersAsync

      val output = fetchAllWithRequestsLike(() ? new ListClustersRequest).via(mockEcsClient.listClustersAsync)

      output must contain(new ListClustersResult()).await
    }
  }
} 
开发者ID:Dwolla,项目名称:scala-aws-utils,代码行数:58,代码来源:PaginatedResponseRetrieverSpec.scala

示例3: CloudflareApiExecutorSpec

//设置package包名称以及导入依赖的类
package com.dwolla.cloudflare

import org.apache.http.HttpResponse
import org.apache.http.client.methods.{CloseableHttpResponse, HttpRequestBase}
import org.apache.http.impl.client.CloseableHttpClient
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mock.Mockito
import org.specs2.mutable.Specification
import org.specs2.specification.Scope

class CloudflareApiExecutorSpec(implicit ee: ExecutionEnv) extends Specification with Mockito {

  trait Setup extends Scope {
    val authorization = CloudflareAuthorization("email", "key")
    val mockHttpClient = mock[CloseableHttpClient]

    val executor = new CloudflareApiExecutor(authorization) {
      override lazy val httpClient = mockHttpClient
    }
  }

  "Cloudflare API Executor" should {
    "add required headers to requests" in new Setup {
      val request = mock[HttpRequestBase]
      private val response = mock[CloseableHttpResponse]

      mockHttpClient.execute(request) returns response

      val output = executor.fetch(request)(res ? Some(res))

      output must beSome(response.asInstanceOf[HttpResponse]).await

      there was one(request).addHeader("X-Auth-Email", authorization.email)
      there was one(request).addHeader("X-Auth-Key", authorization.key)
      there was one(request).addHeader("Content-Type", "application/json")
      there was one(response).close()
    }

    "close the HttpClient on close" in new Setup {
      executor.close()

      there was one(mockHttpClient).close()
    }
  }

} 
开发者ID:Dwolla,项目名称:scala-cloudflare,代码行数:47,代码来源:CloudflareApiExecutorSpec.scala

示例4: RetrySpec

//设置package包名称以及导入依赖的类
package eu.shiftforward.apso

import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification

import scala.concurrent.Future

class RetrySpec(implicit ee: ExecutionEnv) extends Specification with FutureExtraMatchers {

  "A Retry mechanism" should {

    "retry a future number of times" in {
      var attempts = 0

      Retry(10) {
        Future {
          attempts = attempts + 1
          attempts
        }.filter(_ > 3)
      }

      attempts must beEqualTo(4).eventually
    }

    "retry a doomed future a number of times until it fails" in {
      var attempts = 0
      val retries = 10

      val f = Retry[Any](retries) {
        Future {
          attempts = attempts + 1
          throw new RuntimeException("Doomed")
        }
      }

      eventually {
        f must throwAn[RuntimeException].await
      }

      attempts must beEqualTo(1 + retries) // 1 attempt + 10 retries
    }
  }
} 
开发者ID:ShiftForward,项目名称:apso,代码行数:44,代码来源:RetrySpec.scala

示例5: ListTagValuesSpec

//设置package包名称以及导入依赖的类
package unit

import io.waylay.kairosdb.driver.KairosDB
import io.waylay.kairosdb.driver.models._
import mockws.MockWS
import org.specs2.mutable.Specification
import play.api.libs.json.Json
import play.api.mvc.Action
import play.api.mvc.Results._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.matcher.{FutureMatchers, ResultMatchers}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

class ListTagValuesSpec extends Specification with FutureMatchers with ResultMatchers {
  "KairosDB#listTagValues" should {
    "return the correct tag values" in { implicit ee: ExecutionEnv =>
      val expected = Seq("mytag", "foo", "bar1")

      val mockWs = MockWS {
        case ("GET", "http://localhost:8080/api/v1/tagvalues") => Action {
          Ok(Json.obj("results" -> expected))
        }
      }

      val kairosDb = new KairosDB(StandaloneMockWs(mockWs), KairosDBConfig(), global)

      val r = kairosDb.listTagValues must be_==(expected).await(1, 3.seconds)
      mockWs.close()
      r
    }
  }
} 
开发者ID:waylayio,项目名称:kairosdb-scala,代码行数:35,代码来源:ListTagValuesSpec.scala

示例6: VersionSpec

//设置package包名称以及导入依赖的类
package unit

import io.waylay.kairosdb.driver.KairosDB
import io.waylay.kairosdb.driver.models._
import mockws.MockWS
import org.specs2.mutable.Specification
import play.api.libs.json.Json
import play.api.mvc.Action
import play.api.mvc.Results._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.matcher.{FutureMatchers, ResultMatchers}
import play.api.libs.ws.{StandaloneWSClient, StandaloneWSRequest}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

class VersionSpec extends Specification with FutureMatchers with ResultMatchers {
  "KairosDB#version" should {
    "return the correct version number" in { implicit ee: ExecutionEnv =>
      val mockWs = MockWS {
        case ("GET", "http://localhost:8080/api/v1/version") => Action {
          Ok(Json.obj("version" -> "KairosDB 0.9.4"))
        }
      }

      val kairosDb = new KairosDB(StandaloneMockWs(mockWs), KairosDBConfig(), global)

      val r = kairosDb.version must be_==("KairosDB 0.9.4").await(1, 3.seconds)
      mockWs.close()
      r
    }
  }


  // remove once this is fixed: https://github.com/leanovate/play-mockws/issues/20
  object StandaloneMockWs{
    def apply(mockWs: MockWS) = new StandaloneMockWs(mockWs)
  }
  class StandaloneMockWs(mockWs: MockWS) extends StandaloneWSClient{
    override def underlying[T]: T = mockWs.underlying[T]

    override def url(url: String): StandaloneWSRequest = mockWs.url(url)

    override def close(): Unit = mockWs.close()
  }
} 
开发者ID:waylayio,项目名称:kairosdb-scala,代码行数:47,代码来源:VersionSpec.scala

示例7: ListTagNamesSpec

//设置package包名称以及导入依赖的类
package unit

import io.waylay.kairosdb.driver.KairosDB
import io.waylay.kairosdb.driver.models._
import mockws.MockWS
import org.specs2.mutable.Specification
import play.api.libs.json.Json
import play.api.mvc.Action
import play.api.mvc.Results._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.matcher.{FutureMatchers, ResultMatchers}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

class ListTagNamesSpec extends Specification with FutureMatchers with ResultMatchers {
  "KairosDB#listTagNames" should {
    "return the correct tag names" in { implicit ee: ExecutionEnv =>
      val expected = Seq("mytag", "foo", "bar1")

      val mockWs = MockWS {
        case ("GET", "http://localhost:8080/api/v1/tagnames") => Action {
          Ok(Json.obj("results" -> expected))
        }
      }

      val kairosDb = new KairosDB(StandaloneMockWs(mockWs), KairosDBConfig(), global)

      val r = kairosDb.listTagNames must be_==(expected).await(1, 3.seconds)
      mockWs.close()
      r
    }
  }
} 
开发者ID:waylayio,项目名称:kairosdb-scala,代码行数:35,代码来源:ListTagNamesSpec.scala

示例8: DeleteMetricSpec

//设置package包名称以及导入依赖的类
package unit

import io.waylay.kairosdb.driver.KairosDB
import io.waylay.kairosdb.driver.models._
import mockws.MockWS
import org.specs2.mutable.Specification
import play.api.mvc.Action
import play.api.mvc.Results._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.matcher.{FutureMatchers, ResultMatchers}

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._

class DeleteMetricSpec extends Specification with FutureMatchers with ResultMatchers {
  "KairosDB#deleteMetric" should {
    "delete metric" in { implicit ee: ExecutionEnv =>
      val mockWs = MockWS {
        case ("DELETE", "http://localhost:8080/api/v1/metric/my.metric.123") => Action {
          NoContent
        }
      }

      val kairosDb = new KairosDB(StandaloneMockWs(mockWs), KairosDBConfig(), global)

      try {
        kairosDb.deleteMetric(MetricName("my.metric.123")) must beEqualTo(()).await(1, 3.seconds)
      }finally {
        mockWs.close()
      }
    }
  }
} 
开发者ID:waylayio,项目名称:kairosdb-scala,代码行数:34,代码来源:DeleteMetricSpec.scala

示例9: VehiclesRepositorySpec

//设置package包名称以及导入依赖的类
package repositories

import scala.concurrent.duration._
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification
import org.specs2.specification.Scope
import models.Vehicle

class VehiclesRepositorySpec(implicit ev: ExecutionEnv) extends Specification {
  trait Context extends Scope with VehiclesFakeRepository

  "Vehicles repository" should {
    "not find vehicle because of incorrect registration" in new Context {
      find("INVALID REGISTRATION", ford.make) must beEqualTo(None).awaitFor(2 seconds)
    }

    "give details of a vehicle" in new Context {
      find(ford.registration, ford.make) must beEqualTo(Some(Vehicle(ford.registration, ford.make))).awaitFor(2 seconds)
    }

    "give case insensitive details of a vehicle" in new Context {
      find(ford.registration.toLowerCase, ford.make.toLowerCase) must beEqualTo(Some(Vehicle(ford.registration.toUpperCase, ford.make.toUpperCase))).awaitFor(2 seconds)
    }
  }
} 
开发者ID:davidainslie,项目名称:voa-test,代码行数:26,代码来源:VehiclesRepositorySpec.scala

示例10: AlwaysPassAuthProviderSpec

//设置package包名称以及导入依赖的类
package org.zalando.zhewbacca

import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification

class AlwaysPassAuthProviderSpec extends Specification {
  val TestTokenInfo = TokenInfo("", Scope.Empty, "token type", "user uid")

  "'Always pass' Authorization Provider" should {
    "accept any tokens and scopes and treat them as valid" in { implicit ee: ExecutionEnv =>
      val authProvider = new AlwaysPassAuthProvider(TestTokenInfo)
      val scope = Scope(Set("any_scope"))
      val token = Some(OAuth2Token("6afe9886-0a0a-4ace-8bc7-fb96920fb764"))

      authProvider.valid(token, scope) must beEqualTo(AuthTokenValid(TestTokenInfo)).await
    }
  }

} 
开发者ID:zalando-incubator,项目名称:play-zhewbacca,代码行数:20,代码来源:AlwaysPassAuthProviderSpec.scala

示例11: UserControllerSpec

//设置package包名称以及导入依赖的类
package com.clemble.loveit.user.controller

import com.clemble.loveit.common.ControllerSpec
import com.clemble.loveit.user.model.User
import com.mohiva.play.silhouette.impl.providers.CommonSocialProfile
import org.junit.runner.RunWith
import org.specs2.concurrent.ExecutionEnv
import org.specs2.runner.JUnitRunner
import play.api.libs.json.Json
import com.clemble.loveit.user.model.User.socialProfileJsonFormat
import play.api.test.FakeRequest

@RunWith(classOf[JUnitRunner])
class UserControllerSpec(implicit ee: ExecutionEnv) extends ControllerSpec {

  "CREATE" should {

    "Support single create" in {
      val socialProfile = someRandom[CommonSocialProfile]
      val user = createUser(socialProfile)

      val savedUser = getMyUser(user)
      val expectedUser = (User from socialProfile).copy(id = savedUser.id, created = savedUser.created)
      savedUser must beEqualTo(expectedUser)
    }

    "Return same user on the same authentication" in {
      val socialProfile = someRandom[CommonSocialProfile]
      val firstUser = createUser(socialProfile)
      val firstAuth = ControllerSpec.getUser(firstUser)

      val secondUser = createUser(socialProfile)
      val secondAuth = ControllerSpec.getUser(secondUser)

      firstAuth shouldNotEqual secondAuth
      secondUser shouldEqual firstUser
    }

    "sets a userId as a cookie" in {
      val json = Json.toJson(someRandom[CommonSocialProfile])
      val req = FakeRequest(POST, "/api/v1/auth/authenticate/test").
        withJsonBody(json)
      val res = await(route(application, req).get)

      ControllerSpec.setUser(res)
      val setCookie = res.header.headers.get(SET_COOKIE)

      setCookie shouldNotEqual None

      val userCookie = setCookie.get
      val userId = setCookie.get.substring(7, userCookie.indexOf(";"))
      val expectedId = getMyUser(userId).id
      userId shouldEqual expectedId
    }

  }

} 
开发者ID:thankyo,项目名称:thank,代码行数:59,代码来源:UserControllerSpec.scala

示例12: ThankTransactionRepositorySpec

//设置package包名称以及导入依赖的类
package com.clemble.loveit.payment.service.repository

import com.clemble.loveit.common.RepositorySpec
import com.clemble.loveit.common.model.{Resource, UserID}
import com.clemble.loveit.payment.model.ThankTransaction
import org.junit.runner.RunWith
import org.specs2.concurrent.ExecutionEnv
import org.specs2.runner.JUnitRunner

import scala.collection.immutable.Seq

@RunWith(classOf[JUnitRunner])
class ThankTransactionRepositorySpec(implicit ee: ExecutionEnv) extends RepositorySpec {

  val repo = dependency[ThankTransactionRepository]

  "CREATE" should {

    "same resource transactions saved only once" in {
      val user = createUser().id
      val res = someRandom[Resource]
      val A = ThankTransaction(user, someRandom[UserID], res)
      val B = ThankTransaction(user, someRandom[UserID], res)

      await(repo.save(A))
      await(repo.save(B))

      val userTransactions = repo.findByUser(user).toSeq()
      userTransactions.size shouldEqual 1
    }

    "save all payments for the user" in {
      val user = createUser().id
      val A = ThankTransaction(user, someRandom[UserID], someRandom[Resource])
      val B = ThankTransaction(user, someRandom[UserID], someRandom[Resource])

      await(repo.save(A))
      await(repo.save(B))
      val transactions = repo.findByUser(user).toSeq

      transactions must containAllOf(Seq(A, B)).exactly
    }

    "remove specified" in {
      val user = createUser().id
      val A = ThankTransaction(user, someRandom[UserID], someRandom[Resource])
      val B = ThankTransaction(user, someRandom[UserID], someRandom[Resource])

      await(repo.save(A))
      await(repo.save(B))

      await(repo.removeAll(Seq(A)))

      val afterRemove = repo.findByUser(user).toSeq
      afterRemove shouldEqual Seq(B)
    }

  }

} 
开发者ID:thankyo,项目名称:thank,代码行数:61,代码来源:ThankTransactionRepositorySpec.scala

示例13: SQSSpec

//设置package包名称以及导入依赖的类
package uk.gov.homeoffice.aws.sqs

import com.amazonaws.ClientConfiguration
import com.amazonaws.auth.AnonymousAWSCredentials
import com.amazonaws.retry.PredefinedRetryPolicies
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification

class SQSSpec(implicit env: ExecutionEnv) extends Specification {
  "SQS" should {
    "configured" in new SQSServerEmbedded {
      override implicit val sqsClient: SQSClient = new SQSClient(sqsHost, new AnonymousAWSCredentials())(new ClientConfiguration().withRetryPolicy(PredefinedRetryPolicies.NO_RETRY_POLICY))

      sqsClient.clientConfig.getRetryPolicy mustEqual PredefinedRetryPolicies.NO_RETRY_POLICY
    }

    "configured implicitly" in new SQSServerEmbedded {
      implicit val clientConfiguration = new ClientConfiguration().withRetryPolicy(PredefinedRetryPolicies.NO_RETRY_POLICY)

      override implicit val sqsClient: SQSClient = new SQSClient(sqsHost, new AnonymousAWSCredentials())

      sqsClient.clientConfig.getRetryPolicy mustEqual PredefinedRetryPolicies.NO_RETRY_POLICY
    }
  }
} 
开发者ID:UKHomeOffice,项目名称:aws-scala-lib,代码行数:26,代码来源:SQSSpec.scala

示例14: ResponseComparatorSpec

//设置package包名称以及导入依赖的类
package com.github.pheymann.rrt.util

import akka.http.scaladsl.model.{HttpResponse, StatusCodes}
import akka.stream.ActorMaterializer
import com.github.pheymann.rrt._
import com.github.pheymann.rrt.util.ResponseComparator.{ComparisonResult, FailureWithValues}
import com.github.pheymann.rrt.WithActorSystem
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.Specification

class ResponseComparatorSpec(implicit ee: ExecutionEnv) extends Specification {

  sequential

  val testConfig = newConfig("comparator-spec", "", 80, "", 80)

  "The ResponseComparator" should {
    "compare the HttpResponses and document all differences" in new WithActorSystem {
      implicit val materializer = ActorMaterializer()

      val actualResponse = HttpResponse(entity = "{\"id\":0}")

      ResponseComparator.compareResponses(
        actualResponse,
        actualResponse,
        BodyAsStringComparison.stringComparison,
        testConfig
      ) should beEqualTo(ComparisonResult(true, Nil)).awaitFor(testConfig.timeout)

      ResponseComparator.compareResponses(
        actualResponse,
        HttpResponse(status = StatusCodes.NotFound, entity = "{\"id\":0}"),
        BodyAsStringComparison.stringComparison,
        testConfig
      ) should beEqualTo(ComparisonResult(
        false,
        List(FailureWithValues("status", "200 OK", "404 Not Found"))
      )).awaitFor(testConfig.timeout)
    }
  }

} 
开发者ID:pheymann,项目名称:rest-refactoring-test,代码行数:43,代码来源:ResponseComparatorSpec.scala

示例15: FtpSpecs

//设置package包名称以及导入依赖的类
package com.github.jarlakxen.reactive.ftp

import scala.concurrent._
import scala.concurrent.duration._

import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl._
import akka.testkit._
import akka.util.ByteString

import org.junit.runner.RunWith
import org.specs2.concurrent.ExecutionEnv
import org.specs2.mutable.SpecificationLike
import org.specs2.runner.JUnitRunner
import org.specs2.specification.AfterAll

@RunWith(classOf[JUnitRunner])
class FtpSpecs(implicit ee: ExecutionEnv) extends TestKit(ActorSystem("FtpProtocolManagerSpec")) with DockerFTPSpec with ImplicitSender with SpecificationLike with AfterAll {
  import FtpSpecs._
  sequential

  import system.dispatcher
  implicit val materializer = ActorMaterializer()

  override def afterAll(): Unit = {
    super.afterAll()
    TestKit.shutdownActorSystem(system)
  }

  "Ftp" should {

    "list files by pattern" in {
      val files = Ftp().filesFrom("localhost", ftpPort, "test2", "test", "/", "^.*\\.txt$".r).runWith(sinkRemoteFileNames)

     files must be_==(List("file1.txt", "file2.txt")).awaitFor(5 seconds)
    }

    "download files by pattern" in {
      val filesContent = Ftp().filesFrom("localhost", ftpPort, "test2", "test", "/", "^.*\\.txt$".r).runWith(sinkRemoteFileContents).flatMap(contents => Future.sequence(contents))

      filesContent.map(_.map(_.utf8String)) must be_==(List("", "something")).awaitFor(5 seconds)
    }

  }

}

object FtpSpecs {

  val sinkRemoteFileNames =
    Flow[Ftp.RemoteFile]
      .map(_.name)
      .toMat(Sink.fold(List.empty[String])(_ :+ _))(Keep.right)

  def sinkRemoteFileContents(implicit materializer: ActorMaterializer) =
    Flow[Ftp.RemoteFile]
      .map(_.stream.runFold(ByteString.empty)(_ ++ _))
      .toMat(Sink.fold(List.empty[Future[ByteString]])(_ :+ _))(Keep.right)

} 
开发者ID:Jarlakxen,项目名称:reactive-ftp,代码行数:62,代码来源:FtpSpecs.scala


注:本文中的org.specs2.concurrent.ExecutionEnv类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。