Fixed objectSummaries

Fixed bug with objectSummaries. Now, more than 1000 summaries can be
returned.   To avoid memory issues, this version returns a stream.  Of
course, that stream can be converted to a list. Addresses #29 ans #32 
Probably because too many connections are open. —
Sent from Mailbox

On Tue, Jun 10, 2014 at 7:40 PM, Kazuhiro Sera <notifications@github.com>
wrote:

>> @@ -102,12 +103,39 @@ trait S3 extends aws.AmazonS3 {
>>    def metadata(bucket: Bucket, key: String) = getObjectMetadata(bucket.name, key)
>>  
>>    // listObjects
>> -  def objectSummaries(bucket: Bucket): Seq[S3ObjectSummary] = {
>> -    listObjects(bucket.name).getObjectSummaries.asScala.map(s => S3ObjectSummary(bucket, s)).toSeq
>> -  }
>> -
>> -  def objectSummaries(bucket: Bucket, prefix: String): Seq[S3ObjectSummary] = {
>> -    listObjects(bucket.name, prefix).getObjectSummaries.asScala.map(s => S3ObjectSummary(bucket, s)).toSeq
>> +  def objectSummaries(bucket: Bucket): Seq[S3ObjectSummary] = objectSummaries(bucket, "")
>> +
>> +  def objectSummaries(bucket: Bucket, prefix: String): Stream[S3ObjectSummary] = {
> Thanks. I just tried but unfortunately your test failed.
> ```
> INFO: Unable to execute HTTP request: Timeout waiting for connection
> org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection
> 	at org.apache.http.impl.conn.PoolingClientConnectionManager.leaseConnection(PoolingClientConnectionManager.java:232)
> 	at org.apache.http.impl.conn.PoolingClientConnectionManager$1.getConnection(PoolingClientConnectionManager.java:199)
> 	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:606)
> 	at com.amazonaws.http.conn.ClientConnectionRequestFactory$Handler.invoke(ClientConnectionRequestFactory.java:70)
> 	at com.amazonaws.http.conn.$Proxy9.getConnection(Unknown Source)
> 	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:456)
> 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:906)
> 	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
> 	at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:402)
> 	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:245)
> 	at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3573)
> 	at com.amazonaws.services.s3.AmazonS3Client.deleteObject(AmazonS3Client.java:1755)
> 	at com.amazonaws.services.s3.AmazonS3Client.deleteObject(AmazonS3Client.java:1740)
> 	at awscala.s3.S3$class.deleteObject(S3.scala:207)
> 	at awscala.s3.S3Client.deleteObject(S3.scala:234)
> 	at awscala.s3.Bucket.delete(Bucket.scala:53)
> 	at awscala.S3Spec$$anonfun$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$1.apply(S3Spec.scala:37)
> 	at awscala.S3Spec$$anonfun$1$$anonfun$apply$mcV$sp$2$$anonfun$apply$1.apply(S3Spec.scala:37)
> 	at scala.Option.map(Option.scala:145)
> 	at awscala.S3Spec$$anonfun$1$$anonfun$apply$mcV$sp$2.apply(S3Spec.scala:37)
> 	at awscala.S3Spec$$anonfun$1$$anonfun$apply$mcV$sp$2.apply(S3Spec.scala:37)
> 	at scala.collection.immutable.List.foreach(List.scala:318)
> 	at awscala.S3Spec$$anonfun$1.apply$mcV$sp(S3Spec.scala:36)
> 	at awscala.S3Spec$$anonfun$1.apply(S3Spec.scala:15)
> 	at awscala.S3Spec$$anonfun$1.apply(S3Spec.scala:15)
> 	at org.scalatest.Transformer$$anonfun$apply$1.apply$mcV$sp(Transformer.scala:22)
> 	at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
> 	at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
> 	at org.scalatest.Transformer.apply(Transformer.scala:22)
> 	at org.scalatest.Transformer.apply(Transformer.scala:20)
> 	at org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1639)
> 	at org.scalatest.Suite$class.withFixture(Suite.scala:1121)
> 	at org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1683)
> 	at org.scalatest.FlatSpecLike$class.invokeWithFixture$1(FlatSpecLike.scala:1636)
> 	at org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1648)
> 	at org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1648)
> 	at org.scalatest.SuperEngine.runTestImpl(Engine.scala:306)
> 	at org.scalatest.FlatSpecLike$class.runTest(FlatSpecLike.scala:1648)
> 	at org.scalatest.FlatSpec.runTest(FlatSpec.scala:1683)
> 	at org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1706)
> 	at org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1706)
> 	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:413)
> 	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401)
> 	at scala.collection.immutable.List.foreach(List.scala:318)
> 	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
> 	at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:390)
> 	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:427)
> 	at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:401)
> 	at scala.collection.immutable.List.foreach(List.scala:318)
> 	at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:401)
> 	at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:396)
> 	at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:483)
> 	at org.scalatest.FlatSpecLike$class.runTests(FlatSpecLike.scala:1706)
> 	at org.scalatest.FlatSpec.runTests(FlatSpec.scala:1683)
> 	at org.scalatest.Suite$class.run(Suite.scala:1423)
> 	at org.scalatest.FlatSpec.org$scalatest$FlatSpecLike$$super$run(FlatSpec.scala:1683)
> 	at org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1752)
> 	at org.scalatest.FlatSpecLike$$anonfun$run$1.apply(FlatSpecLike.scala:1752)
> 	at org.scalatest.SuperEngine.runImpl(Engine.scala:545)
> 	at org.scalatest.FlatSpecLike$class.run(FlatSpecLike.scala:1752)
> 	at org.scalatest.FlatSpec.run(FlatSpec.scala:1683)
> 	at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:444)
> 	at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:651)
> 	at sbt.TestRunner.runTest$1(TestFramework.scala:84)
> 	at sbt.TestRunner.run(TestFramework.scala:94)
> 	at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:219)
> 	at sbt.TestFramework$$anon$2$$anonfun$$init$$1$$anonfun$apply$8.apply(TestFramework.scala:219)
> 	at sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:207)
> 	at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:219)
> 	at sbt.TestFramework$$anon$2$$anonfun$$init$$1.apply(TestFramework.scala:219)
> 	at sbt.TestFunction.apply(TestFramework.scala:224)
> 	at sbt.Tests$$anonfun$7.apply(Tests.scala:196)
> 	at sbt.Tests$$anonfun$7.apply(Tests.scala:196)
> 	at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:45)
> 	at sbt.std.Transform$$anon$3$$anonfun$apply$2.apply(System.scala:45)
> 	at sbt.std.Transform$$anon$4.work(System.scala:64)
> 	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
> 	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
> 	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
> 	at sbt.Execute.work(Execute.scala:244)
> 	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
> 	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
> 	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
> 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> 	at java.lang.Thread.run(Thread.java:744)
> ```
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/seratch/AWScala/pull/31/files#r13631484