Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine 谷歌应用程序引擎能否';s ImagesServiceFactory.getImagesService()是否用于单元测试?_Google App Engine - Fatal编程技术网

Google app engine 谷歌应用程序引擎能否';s ImagesServiceFactory.getImagesService()是否用于单元测试?

Google app engine 谷歌应用程序引擎能否';s ImagesServiceFactory.getImagesService()是否用于单元测试?,google-app-engine,Google App Engine,我设法让下面的代码片段在开发服务器中成功运行,作为web请求的一部分,将图像大小重新调整为300x300像素 然而,我似乎无法在单元测试中运行它们 byte[] data = loadMyData(); OutputSettings format = new OutputSettings(ImagesService.OutputEncoding.JPEG); Image resized = getImagesService().applyTransform(makeResize(300, 30

我设法让下面的代码片段在开发服务器中成功运行,作为web请求的一部分,将图像大小重新调整为300x300像素

然而,我似乎无法在单元测试中运行它们

byte[] data = loadMyData();
OutputSettings format = new OutputSettings(ImagesService.OutputEncoding.JPEG);

Image resized = getImagesService().applyTransform(makeResize(300, 300, 0, 0), data, format);
上面的代码在单元测试中引发此异常:

java.lang.IllegalArgumentException: Failed to read image
    at com.google.appengine.api.images.ImagesServiceImpl.convertApplicationException(ImagesServiceImpl.java:333)
    at com.google.appengine.api.images.ImagesServiceImpl.applyTransform(ImagesServiceImpl.java:86)
    at com.google.appengine.api.images.ImagesServiceImpl.applyTransform(ImagesServiceImpl.java:63)
将“LocalImagesServiceTestConfig”添加到LocalServiceTestHelper没有任何区别


希望有人能确认我们是否真的可以在(Java)单元测试中使用getImagesService()来调整图像大小。

我可能在这里遗漏了一些东西,但您不能使用
get\u serving\u url
来调整图像大小吗?它可用于Java
imagesService.getServingUrl(blob)
当做
Niklas

我打算通过一个单独的任务将调整大小的图像上传到Amazon S3。想法是将调整大小的字节作为临时存储在blobstore中。