Skip to content

Feature/scala 2.12 #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
sudo: false
language: scala

scala:
- 2.11.6
- 2.10.5
- 2.11.12
- 2.10.6

jdk:
- oraclejdk7
- oraclejdk8

matrix:
include:
- scala: 2.12.6
jdk: oraclejdk8

cache:
directories:
- $HOME/.ivy2/cache
Expand Down
9 changes: 3 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

organization in ThisBuild := "com.github.dwhjames"
organization in ThisBuild := "com.outworkers"

licenses in ThisBuild += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))

scalaVersion in ThisBuild := "2.11.7"
scalaVersion in ThisBuild := "2.12.6"

crossScalaVersions in ThisBuild := Seq("2.10.5", "2.11.7")
crossScalaVersions in ThisBuild := Seq("2.10.6", "2.11.12", "2.12.6")

shellPrompt in ThisBuild := CustomShellPrompt.customPrompt

Expand All @@ -15,7 +15,6 @@ resolvers in ThisBuild ++= Seq(
)



lazy val awsWrap = project in file(".")

name := "aws-wrap"
Expand All @@ -31,11 +30,9 @@ libraryDependencies ++= Seq(
Dependencies.Compile.slf4j
)


bintrayPackageLabels := Seq("aws", "dynamodb", "s3", "ses", "simpledb", "sns", "sqs", "async", "future")



lazy val awsWrapTest = project.
in(file("integration")).
configs(IntegrationTest).
Expand Down
13 changes: 6 additions & 7 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ object Dependencies {

object V {
val awsJavaSDK = "1.10.32"
val jodaTime = "2.10"
val jodaConvert = "2.1.1"

val jodaTime = "2.9"
val jodaConvert = "1.8"
val slf4j = "1.7.25"

val slf4j = "1.7.12"

val logback = "1.1.3"
val logback = "1.1.3"
}

object Compile {
Expand All @@ -29,11 +28,11 @@ object Dependencies {

val slf4j = "org.slf4j" % "slf4j-api" % V.slf4j

val logback = "ch.qos.logback" % "logback-classic" % V.logback
val logback = "ch.qos.logback" % "logback-classic" % V.logback
}

object IntegrationTest {

val scalaTest = "org.scalatest" %% "scalatest" % "2.2.4" % "it"
val scalaTest = "org.scalatest" %% "scalatest" % "3.0.4" % "it"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ import com.amazonaws.handlers.AsyncHandler

package object awswrap {

private def promiseToAsyncHandler[Request <: AmazonWebServiceRequest, Result](p: Promise[Result]) =
private def promiseToAsyncHandler[Request <: AmazonWebServiceRequest, Result](p: Promise[Result]): AsyncHandler[Request, Result] =
new AsyncHandler[Request, Result] {
override def onError(exception: Exception): Unit = { p.failure(exception); () }
override def onSuccess(request: Request, result: Result): Unit = { p.success(result); () }
}

private def promiseToVoidAsyncHandler[Request <: AmazonWebServiceRequest](p: Promise[Unit]) =
private def promiseToVoidAsyncHandler[Request <: AmazonWebServiceRequest](p: Promise[Unit]): AsyncHandler[Request, Void] =
new AsyncHandler[Request, Void] {
override def onError(exception: Exception): Unit = { p.failure(exception); () }
override def onSuccess(request: Request, result: Void): Unit = { p.success(()); () }
}

@inline
private[awswrap] def wrapAsyncMethod[Request <: AmazonWebServiceRequest, Result](
f: (Request, AsyncHandler[Request, Result]) => JFuture[Result],
private[awswrap] def wrapAsyncMethod[
Request <: AmazonWebServiceRequest,
Result
](
f: (Request, AsyncHandler[Request, Result]) => JFuture[Result],
request: Request
): Future[Result] = {
val p = Promise[Result]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@

package com.github.dwhjames.awswrap.dynamodb

import java.{util => ju}
import java.util.Random
import java.{util => ju}

import com.amazonaws.{AmazonClientException, AmazonServiceException, ClientConfiguration}
import com.amazonaws.auth.{AWSCredentials, AWSCredentialsProvider, BasicAWSCredentials}
import com.amazonaws.auth.{AWSCredentials, AWSCredentialsProvider}
import com.amazonaws.internal.StaticCredentialsProvider
import com.amazonaws.retry.RetryUtils
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient
import com.amazonaws.services.dynamodbv2.model.{BatchWriteItemRequest, ProvisionedThroughputExceededException, ReturnConsumedCapacity, WriteRequest}

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.amazonaws.{AmazonServiceException, ClientConfiguration}
import org.slf4j.{Logger, LoggerFactory};


class SingleThreadedBatchWriter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,24 @@
package com.github.dwhjames.awswrap
package s3

import java.io.{InputStream, File}
import java.io.{File, InputStream}
import java.net.URL

import scala.collection.JavaConverters._
import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.Try

import java.util.concurrent.{Executors, ExecutorService, ThreadFactory}
import java.util.concurrent.atomic.AtomicLong
import java.util.concurrent.{ExecutorService, Executors, ThreadFactory}

import com.amazonaws.{AmazonWebServiceRequest, ClientConfiguration}
import com.amazonaws.ClientConfiguration
import com.amazonaws.auth.{AWSCredentials, AWSCredentialsProvider, DefaultAWSCredentialsProviderChain}
import com.amazonaws.event.{ProgressListener, ProgressEvent, ProgressEventType}
import com.amazonaws.internal.StaticCredentialsProvider;
import com.amazonaws.event.{ProgressEvent, ProgressEventType, ProgressListener}
import com.amazonaws.internal.StaticCredentialsProvider
import com.amazonaws.services.s3._
import com.amazonaws.services.s3.model._
import com.amazonaws.services.s3.transfer.Transfer

import org.slf4j.{Logger, LoggerFactory}

import scala.collection.JavaConverters._
import scala.concurrent.{Future, Promise}
import scala.util.Try


private[s3] class S3ThreadFactory extends ThreadFactory {
private val count = new AtomicLong(0L)
Expand Down Expand Up @@ -573,7 +571,7 @@ object FutureTransfer {
* @see [[com.amazonaws.event.ProgressListener ProgressListener]]
*/
def listenFor[T <: Transfer](transfer: T): Future[transfer.type] = {
import com.amazonaws.services.s3.transfer.internal.{ AbstractTransfer, TransferStateChangeListener }
import com.amazonaws.services.s3.transfer.internal.{AbstractTransfer, TransferStateChangeListener}
val transferDescription = transfer.getDescription
def debugLog(eventType: String): Unit = {
logger.debug(s"$eventType : $transferDescription")
Expand Down Expand Up @@ -716,10 +714,9 @@ object FutureTransfer {
*/
if (transfer.isDone) {
val success = p trySuccess transfer
if (logger.isDebugEnabled) {
if (success) {
logger.debug(s"promise successfully completed from outside of callbacks for $transferDescription")
}

if (success) {
logger.debug(s"promise successfully completed from outside of callbacks for $transferDescription")
}
}

Expand Down