mirror of https://github.com/apache/jclouds.git
Fixed compilation failures caused by 70fa74df1a
This commit is contained in:
parent
682f047bad
commit
3654527302
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.demo.tweetstore.functions;
|
package org.jclouds.demo.tweetstore.functions;
|
||||||
|
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobMap;
|
import org.jclouds.blobstore.BlobMap;
|
||||||
|
@ -27,6 +25,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class KeyToStoredTweetStatus implements Function<String, StoredTweetStatu
|
||||||
Blob blob = map.get(id);
|
Blob blob = map.get(id);
|
||||||
status = ((System.currentTimeMillis() - start) + "ms");
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
||||||
tweet = toString(blob.getPayload());
|
tweet = Strings2.toString(blob.getPayload());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,6 +35,7 @@ import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.TransientApiMetadata;
|
import org.jclouds.blobstore.TransientApiMetadata;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
|
@ -107,13 +107,13 @@ public class StoreTweetsControllerTest {
|
||||||
assertEquals(frankBlob.getMetadata().getName(), "1");
|
assertEquals(frankBlob.getMetadata().getName(), "1");
|
||||||
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
||||||
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(frankBlob.getPayload()), "I love beans!");
|
assertEquals(Strings2.toString(frankBlob.getPayload()), "I love beans!");
|
||||||
|
|
||||||
Blob jimmyBlob = map.get("2");
|
Blob jimmyBlob = map.get("2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
||||||
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(jimmyBlob.getPayload()), "cloud is king");
|
assertEquals(Strings2.toString(jimmyBlob.getPayload()), "cloud is king");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.demo.tweetstore.functions;
|
package org.jclouds.demo.tweetstore.functions;
|
||||||
|
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobMap;
|
import org.jclouds.blobstore.BlobMap;
|
||||||
|
@ -27,6 +25,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class KeyToStoredTweetStatus implements Function<String, StoredTweetStatu
|
||||||
Blob blob = map.get(id);
|
Blob blob = map.get(id);
|
||||||
status = ((System.currentTimeMillis() - start) + "ms");
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
||||||
tweet = toString(blob.getPayload());
|
tweet = Strings2.toString(blob.getPayload());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,6 +35,7 @@ import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.TransientApiMetadata;
|
import org.jclouds.blobstore.TransientApiMetadata;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
|
@ -107,13 +107,13 @@ public class StoreTweetsControllerTest {
|
||||||
assertEquals(frankBlob.getMetadata().getName(), "1");
|
assertEquals(frankBlob.getMetadata().getName(), "1");
|
||||||
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
||||||
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(frankBlob.getPayload()), "I love beans!");
|
assertEquals(Strings2.toString(frankBlob.getPayload()), "I love beans!");
|
||||||
|
|
||||||
Blob jimmyBlob = map.get("2");
|
Blob jimmyBlob = map.get("2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
||||||
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(jimmyBlob.getPayload()), "cloud is king");
|
assertEquals(Strings2.toString(jimmyBlob.getPayload()), "cloud is king");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.demo.tweetstore.functions;
|
package org.jclouds.demo.tweetstore.functions;
|
||||||
|
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobMap;
|
import org.jclouds.blobstore.BlobMap;
|
||||||
|
@ -27,6 +25,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class KeyToStoredTweetStatus implements Function<String, StoredTweetStatu
|
||||||
Blob blob = map.get(id);
|
Blob blob = map.get(id);
|
||||||
status = ((System.currentTimeMillis() - start) + "ms");
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
||||||
tweet = toString(blob.getPayload());
|
tweet = Strings2.toString(blob.getPayload());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,6 +35,7 @@ import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.TransientApiMetadata;
|
import org.jclouds.blobstore.TransientApiMetadata;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
|
@ -107,13 +107,13 @@ public class StoreTweetsControllerTest {
|
||||||
assertEquals(frankBlob.getMetadata().getName(), "1");
|
assertEquals(frankBlob.getMetadata().getName(), "1");
|
||||||
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
||||||
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(frankBlob.getPayload()), "I love beans!");
|
assertEquals(Strings2.toString(frankBlob.getPayload()), "I love beans!");
|
||||||
|
|
||||||
Blob jimmyBlob = map.get("2");
|
Blob jimmyBlob = map.get("2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
||||||
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(jimmyBlob.getPayload()), "cloud is king");
|
assertEquals(Strings2.toString(jimmyBlob.getPayload()), "cloud is king");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.demo.tweetstore.functions;
|
package org.jclouds.demo.tweetstore.functions;
|
||||||
|
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobMap;
|
import org.jclouds.blobstore.BlobMap;
|
||||||
|
@ -27,6 +25,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class KeyToStoredTweetStatus implements Function<String, StoredTweetStatu
|
||||||
Blob blob = map.get(id);
|
Blob blob = map.get(id);
|
||||||
status = ((System.currentTimeMillis() - start) + "ms");
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
||||||
tweet = toString(blob.getPayload());
|
tweet = Strings2.toString(blob.getPayload());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,6 +35,7 @@ import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.TransientApiMetadata;
|
import org.jclouds.blobstore.TransientApiMetadata;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
|
@ -108,13 +108,13 @@ public class StoreTweetsControllerTest {
|
||||||
assertEquals(frankBlob.getMetadata().getName(), "1");
|
assertEquals(frankBlob.getMetadata().getName(), "1");
|
||||||
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
||||||
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(frankBlob.getPayload()), "I love beans!");
|
assertEquals(Strings2.toString(frankBlob.getPayload()), "I love beans!");
|
||||||
|
|
||||||
Blob jimmyBlob = map.get("2");
|
Blob jimmyBlob = map.get("2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
||||||
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(jimmyBlob.getPayload()), "cloud is king");
|
assertEquals(Strings2.toString(jimmyBlob.getPayload()), "cloud is king");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.demo.tweetstore.functions;
|
package org.jclouds.demo.tweetstore.functions;
|
||||||
|
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobMap;
|
import org.jclouds.blobstore.BlobMap;
|
||||||
|
@ -27,6 +25,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class KeyToStoredTweetStatus implements Function<String, StoredTweetStatu
|
||||||
Blob blob = map.get(id);
|
Blob blob = map.get(id);
|
||||||
status = ((System.currentTimeMillis() - start) + "ms");
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
||||||
tweet = toString(blob.getPayload());
|
tweet = Strings2.toString(blob.getPayload());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,6 +35,7 @@ import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.TransientApiMetadata;
|
import org.jclouds.blobstore.TransientApiMetadata;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
|
@ -107,13 +107,13 @@ public class StoreTweetsControllerTest {
|
||||||
assertEquals(frankBlob.getMetadata().getName(), "1");
|
assertEquals(frankBlob.getMetadata().getName(), "1");
|
||||||
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
||||||
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(frankBlob.getPayload()), "I love beans!");
|
assertEquals(Strings2.toString(frankBlob.getPayload()), "I love beans!");
|
||||||
|
|
||||||
Blob jimmyBlob = map.get("2");
|
Blob jimmyBlob = map.get("2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
||||||
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(jimmyBlob.getPayload()), "cloud is king");
|
assertEquals(Strings2.toString(jimmyBlob.getPayload()), "cloud is king");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.jclouds.demo.tweetstore.functions;
|
package org.jclouds.demo.tweetstore.functions;
|
||||||
|
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import org.jclouds.blobstore.BlobMap;
|
import org.jclouds.blobstore.BlobMap;
|
||||||
|
@ -27,6 +25,7 @@ import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
import org.jclouds.demo.tweetstore.domain.StoredTweetStatus;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
import org.jclouds.logging.Logger;
|
import org.jclouds.logging.Logger;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
|
||||||
|
@ -59,7 +58,7 @@ public class KeyToStoredTweetStatus implements Function<String, StoredTweetStatu
|
||||||
Blob blob = map.get(id);
|
Blob blob = map.get(id);
|
||||||
status = ((System.currentTimeMillis() - start) + "ms");
|
status = ((System.currentTimeMillis() - start) + "ms");
|
||||||
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
from = blob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME);
|
||||||
tweet = toString(blob.getPayload());
|
tweet = Strings2.toString(blob.getPayload());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
logger.error(e, "Error listing container %s//%s/%s", service, container, id);
|
||||||
status = (e.getMessage());
|
status = (e.getMessage());
|
||||||
|
|
|
@ -22,7 +22,6 @@ import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.expect;
|
import static org.easymock.EasyMock.expect;
|
||||||
import static org.easymock.EasyMock.replay;
|
import static org.easymock.EasyMock.replay;
|
||||||
import static org.easymock.EasyMock.verify;
|
import static org.easymock.EasyMock.verify;
|
||||||
import static org.jclouds.util.Strings2.toStringAndClose;
|
|
||||||
import static org.testng.Assert.assertEquals;
|
import static org.testng.Assert.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -36,6 +35,7 @@ import org.jclouds.blobstore.BlobStoreContext;
|
||||||
import org.jclouds.blobstore.TransientApiMetadata;
|
import org.jclouds.blobstore.TransientApiMetadata;
|
||||||
import org.jclouds.blobstore.domain.Blob;
|
import org.jclouds.blobstore.domain.Blob;
|
||||||
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
import org.jclouds.demo.tweetstore.reference.TweetStoreConstants;
|
||||||
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import twitter4j.Status;
|
import twitter4j.Status;
|
||||||
|
@ -107,13 +107,13 @@ public class StoreTweetsControllerTest {
|
||||||
assertEquals(frankBlob.getMetadata().getName(), "1");
|
assertEquals(frankBlob.getMetadata().getName(), "1");
|
||||||
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
assertEquals(frankBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "frank");
|
||||||
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(frankBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(frankBlob.getPayload()), "I love beans!");
|
assertEquals(Strings2.toString(frankBlob.getPayload()), "I love beans!");
|
||||||
|
|
||||||
Blob jimmyBlob = map.get("2");
|
Blob jimmyBlob = map.get("2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
assertEquals(jimmyBlob.getMetadata().getName(), "2");
|
||||||
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
assertEquals(jimmyBlob.getMetadata().getUserMetadata().get(TweetStoreConstants.SENDER_NAME), "jimmy");
|
||||||
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
assertEquals(jimmyBlob.getMetadata().getContentMetadata().getContentType(), "text/plain");
|
||||||
assertEquals(toString(jimmyBlob.getPayload()), "cloud is king");
|
assertEquals(Strings2.toString(jimmyBlob.getPayload()), "cloud is king");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue