</execution>
</executions>
</plugin>
+
+ <!-- Integration Test plugins: jetty, failsafe, and remote-resources -->
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <version>9.4.57.v20241219</version>
+ <executions>
+ <execution>
+ <id>start-jetty</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <skip>${skipTests}</skip>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop-jetty</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>3.5.3</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <includes>
+ <include>**/*IT.class</include>
+ </includes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <version>3.3.0</version>
+ </plugin>
</plugins>
</pluginManagement>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.blob</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <groupId>org.collectionspace.services.blob</groupId>
+ <artifactId>blob-test-utils</artifactId>
+ <name>services.blob.blob-test-utils</name>
+ <packaging>jar</packaging>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>bundle</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <includes>
+ <include>**/*.jpg</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+package org.collectionspace.serivces.blob;
+
+/**
+ * Static images which are served by an embedded jetty server. These are the images found under src/main/resources and
+ * it's expected that they're served on /static in jetty, e.g. /static/bird.jpg
+ *
+ * @since 8.3.0
+ */
+public enum StaticImage {
+ BIRD("bird.jpg"),
+ DECK("deck.jpg");
+
+ private final String path;
+
+ StaticImage(final String path) {
+ this.path = path;
+ }
+
+ public String getUrl() {
+ final String port = System.getProperty("jetty.port");
+ if (port == null) {
+ throw new RuntimeException("jetty.port property is not set; check your maven plugin configuration");
+ }
+
+ return "http://localhost:" + port + "/static/" + path;
+ }
+
+}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.blob</artifactId>
- <version>${revision}</version>
- </parent>
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.blob</artifactId>
+ <version>${revision}</version>
+ </parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>org.collectionspace.services.blob.client</artifactId>
- <name>services.blob.client</name>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.blob.client</artifactId>
+ <name>services.blob.client</name>
- <dependencies>
- <dependency>
- <groupId>org.nuxeo.ecm.core</groupId>
- <artifactId>nuxeo-core-storage-sql-management</artifactId>
- <version>${nuxeo.general.release}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
+ <dependencies>
+ <!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.person.client</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services.blob</groupId>
+ <artifactId>blob-test-utils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
-<!-- CollectionSpace dependencies -->
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
- <optional>true</optional>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.jaxb</artifactId>
- <version>${project.version}</version>
- </dependency>
-<!--
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.common</artifactId>
- <optional>true</optional>
- <version>${project.version}</version>
- </dependency>
- -->
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.person.client</artifactId>
- <version>${project.version}</version>
- </dependency>
-<!-- External dependencies -->
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jaxrs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-jaxb-provider</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.resteasy</groupId>
- <artifactId>resteasy-multipart-provider</artifactId>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
- <finalName>collectionspace-services-blob-client</finalName>
- </build>
+ <build>
+ <finalName>collectionspace-services-blob-client</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.collectionspace.services.blob:blob-test-utils:${project.version}</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.6.0</version>
+ <configuration>
+ <portNames>
+ <portName>jetty.port</portName>
+ <portName>jetty.stop.port</portName>
+ </portNames>
+ <fileSet/>
+ <name/>
+ <regex/>
+ <source/>
+ <value/>
+ </configuration>
+ <executions>
+ <execution>
+ <id>reserve-port</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.5.3</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*IT.class</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <configuration>
+ <httpConnector>
+ <port>${jetty.port}</port>
+ </httpConnector>
+ <stopKey>quit</stopKey>
+ <stopPort>${jetty.stop.port}</stopPort>
+ <stopWait>10</stopWait>
+ <contextHandlers>
+ <contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
+ <contextPath>/static</contextPath>
+ <resourceBase>${project.build.directory}/maven-shared-archive-resources</resourceBase>
+ <handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
+ </contextHandler>
+ </contextHandlers>
+ <supportedPackagings>jar</supportedPackagings>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <jetty.port>${jetty.port}</jetty.port>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.ws.rs.core.Response;
+import org.collectionspace.serivces.blob.StaticImage;
import org.collectionspace.services.client.BlobClient;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.Profiler;
import org.testng.annotations.Test;
@SuppressWarnings("rawtypes")
-public class BlobScaleTest extends BaseServiceTest<AbstractCommonList> {
+public class BlobScaleIT extends BaseServiceTest<AbstractCommonList> {
- private final Logger logger = LoggerFactory.getLogger(BlobScaleTest.class);
+ private final Logger logger = LoggerFactory.getLogger(BlobScaleIT.class);
private static final int IMAGE_SIZE = 1000;
private static final int IMAGE_EDGE = -15;
private static final int MAX_FONTSIZE = 60;
private static final String IMAGES_TO_CREATE_PROP = "imagesToCreate";
private static final int DEFAULT_IMAGES_TO_CREATE = 3; // Override this value by setting a system property named 'imagesToCreate' -i.e., mvn test -DimagesToCreate=30
- private static final int DEFAULT_IMAGES_TO_GET = DEFAULT_IMAGES_TO_CREATE;
private static final String GENERATED_IMAGES = "target/generated_images";
private List<String> allGeneratedImages = new ArrayList<String>();
+ IMAGES_TO_CREATE_PROP
+ "' was defined, so we'll use the default instead.");
} finally {
- logger.info("Testing blob scaling by creating "
- + result
- + " images.");
+ logger.info("Testing blob scaling by creating {} images.", result);
}
return result;
Thread.sleep(3000); // sleep for 3 seconds
for (int i = 0; i < allGeneratedImages.size(); i++) {
- Response res = client.getDerivativeContent(allGeneratedImages.get(i), "Thumbnail");
- try {
- assertStatusCode(res, testName);
- logger.debug(String.format("Performed GET operation on Thumbnail derivative of image blob ID = '%s'.",
- allGeneratedImages.get(i)));
- } finally {
- res.close();
- }
+ Response res = client.getDerivativeContent(allGeneratedImages.get(i), "Thumbnail");
+ try {
+ assertStatusCode(res, testName);
+ logger.debug("Performed GET operation on Thumbnail derivative of image blob ID = '{}'.",
+ allGeneratedImages.get(i));
+ } finally {
+ res.close();
+ }
}
}
for (int i = 0; i < imagesToCreate; i++, profiler.reset()) {
File jpegFile = createJpeg(GENERATED_IMAGES);
- URL url = jpegFile.toURI().toURL();
- profiler.start();
- Response res = client.createBlobFromURI("https://farm6.static.flickr.com/5289/5688023100_15e00cde47_o.jpg");//url.toString());
+ profiler.start();
+ Response res = client.createBlobFromURI(StaticImage.BIRD.getUrl());
try {
profiler.stop();
assertStatusCode(res, testName);
- logger.debug(
- i + ": Uploaded image to Nuxeo in "
- + profiler.getCumulativeTime()
- + " milleseconds "
- + " - "
- + " : "
- + jpegFile.getAbsolutePath());
+ logger.debug("{}: Uploaded image to Nuxeo in {} milleseconds - : {}", i, profiler.getCumulativeTime(),
+ jpegFile.getAbsolutePath());
String csid = extractId(res);
this.knownResourceId = csid;
}
}
- private void createDirectory(String dirName) {
- boolean success = (
- new File(dirName)).mkdir();
- if (success) {
- logger.debug("Directory: "
- + dirName + " created");
- }
- }
+ private void createDirectory(String dirName) {
+ boolean success = (new File(dirName)).mkdir();
+ if (success) {
+ logger.debug("Directory: {} created", dirName);
+ }
+ }
public File createJpeg(String destDir) {
File result = null;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.collectionspace.serivces.blob.StaticImage;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.BlobClient;
import org.collectionspace.services.client.PayloadOutputPart;
* $LastChangedDate: $
*/
@SuppressWarnings("rawtypes")
-public class BlobServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, BlobsCommon> {
+public class BlobServiceIT extends AbstractPoxServiceTestImpl<AbstractCommonList, BlobsCommon> {
- private final String CLASS_NAME = BlobServiceTest.class.getName();
- private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ private final Logger logger = LoggerFactory.getLogger(BlobServiceIT.class);
private final static String KNOWN_IMAGE_FILENAME = "01-03-09_1546.jpg";
private final static int WIDTH_DIMENSION_INDEX = 0;
private final static int HEIGHT_DIMENSION_INDEX = 1;
- private final static String KNOWN_IMAGE_SIZE = "56261";
- private final static BigDecimal KNOWN_IMAGE_WIDTH = new BigDecimal(640.0);
- private final static BigDecimal KNOWN_IMAGE_HEIGHT = new BigDecimal(480.0);
-
- private final static String PUBLIC_URL_BIRD = "https://farm6.static.flickr.com/5289/5688023100_15e00cde47_o.jpg";
- private final static String PUBLIC_URL_DECK = "https://farm8.staticflickr.com/7231/6962564226_4bdfc17599_k_d.jpg";
-
+ private static final String KNOWN_IMAGE_SIZE = "56261";
+ private static final BigDecimal KNOWN_IMAGE_WIDTH = new BigDecimal("640.0");
+ private static final BigDecimal KNOWN_IMAGE_HEIGHT = new BigDecimal("480.0");
private boolean blobCleanup = true;
String blobsDirPath = currentDir + File.separator + BLOBS_DIR;
File blobsDir = new File(blobsDirPath);
if (blobsDir != null && blobsDir.exists()) {
- File[] children = blobsDir.listFiles();
- if (children != null && children.length > 0) {
- for (File child : children) {
- if (isBlobbable(child) == true) {
- Response res = null;
- String mimeType = this.getMimeType(child);
- logger.debug("Processing file URI: " + child.getAbsolutePath());
- logger.debug("MIME type is: " + mimeType);
- if (fromUri == true) {
- if (uri != null) {
- res = client.createBlobFromURI(uri);
- //break;
- } else {
- URL childUrl = child.toURI().toURL();
- res = client.createBlobFromURI(childUrl.toString());
- }
- } else {
- MultipartFormDataOutput form = new MultipartFormDataOutput();
- OutputPart outputPart = form.addFormData("file", child, MediaType.valueOf(mimeType));
- res = client.createBlobFromFormData(form);
- }
- try {
- assertStatusCode(res, testName);
- if (isBlobCleanup() == true) {
- allResourceIdsCreated.add(extractId(res));
- }
- } finally {
- if (res != null) {
- res.close();
- }
- }
- }
- }
- } else {
- logger.debug("Directory: " + blobsDirPath + " is empty or cannot be read.");
- }
+ File[] children = blobsDir.listFiles();
+ if (children != null && children.length > 0) {
+ for (File child : children) {
+ if (isBlobbable(child)) {
+ Response res = null;
+ String mimeType = this.getMimeType(child);
+ logger.debug("Processing file URI: {}", child.getAbsolutePath());
+ logger.debug("MIME type is: {}", mimeType);
+ if (fromUri) {
+ if (uri != null) {
+ res = client.createBlobFromURI(uri);
+ // break;
+ } else {
+ URL childUrl = child.toURI().toURL();
+ res = client.createBlobFromURI(childUrl.toString());
+ }
+ } else {
+ MultipartFormDataOutput form = new MultipartFormDataOutput();
+ OutputPart outputPart = form.addFormData("file", child, MediaType.valueOf(mimeType));
+ res = client.createBlobFromFormData(form);
+ }
+ try {
+ assertStatusCode(res, testName);
+ if (isBlobCleanup()) {
+ allResourceIdsCreated.add(extractId(res));
+ }
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+ }
+ }
+ } else {
+ logger.debug("Directory: {} is empty or cannot be read.", blobsDirPath);
+ }
} else {
- logger.debug("Directory: " + blobsDirPath + " is missing or cannot be read.");
+ logger.debug("Directory: {} is missing or cannot be read.", blobsDirPath);
}
}
// Create the blob
//
BlobClient client = new BlobClient();
- Response res = null;
- res = client.createBlobFromURI(uri);
- String blobCsid = null;
- try {
- assertStatusCode(res, testName);
- blobCsid = extractId(res);
- if (isBlobCleanup() == true) {
- allResourceIdsCreated.add(blobCsid);
- }
- } finally {
- if (res != null) {
+ Response res = null;
+ res = client.createBlobFromURI(uri);
+ String blobCsid = null;
+ try {
+ assertStatusCode(res, testName);
+ blobCsid = extractId(res);
+ if (isBlobCleanup()) {
+ allResourceIdsCreated.add(blobCsid);
+ }
+ } finally {
+ if (res != null) {
res.close();
}
}
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"CRUDTests"})
public void createBlobWithURL1(String testName) throws Exception {
- createBlob(testName, true /*with URI*/, PUBLIC_URL_BIRD);
+ createBlob(testName, true /*with URI*/, StaticImage.BIRD.getUrl());
}
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
dependsOnMethods = {"CRUDTests"})
public void createBlobWithURL2(String testName) throws Exception {
- createBlob(testName, true /*with URI*/, PUBLIC_URL_DECK);
+ createBlob(testName, true /*with URI*/, StaticImage.DECK.getUrl());
}
@Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
PoxPayloadOut multipart = new PoxPayloadOut(BlobClient.SERVICE_PAYLOAD_NAME);
PayloadOutputPart commonPart = multipart.addPart(client.getCommonPartName(), blob);
- if (logger.isDebugEnabled()) {
- logger.debug("to be created, blob common");
- logger.debug(objectAsXmlString(blob, BlobsCommon.class));
- }
+ logger.debug("to be created, blob common");
+ logger.debug(objectAsXmlString(blob, BlobsCommon.class));
return multipart;
}
<url>http://www.collectionspace.org</url>
<modules>
+ <module>blob-test-utils</module>
<module>client</module>
<module>3rdparty</module>
<module>service</module>
+++ /dev/null
-package org.collectionspace.services.test;
-
-//import org.collectionspace.services.blob.Blob;
-//import org.collectionspace.services.blob.BlobList;
-
-/**
- * Placeholder for server-side testing of Loan Out service code.
- *
- * @version $Revision: 2108 $
- */
-public class BlobServiceTest {
- //empty
-}
<artifactId>org.collectionspace.services.person.client</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services.blob</groupId>
+ <artifactId>blob-test-utils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- External dependencies -->
<dependency>
<groupId>org.testng</groupId>
</dependencies>
<build>
- <finalName>collectionspace-services-media-client</finalName>
+ <finalName>collectionspace-services-media-client</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.collectionspace.services.blob:blob-test-utils:${project.version}</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.6.0</version>
+ <configuration>
+ <portNames>
+ <portName>jetty.port</portName>
+ <portName>jetty.stop.port</portName>
+ </portNames>
+ <fileSet/>
+ <name/>
+ <regex/>
+ <source/>
+ <value/>
+ </configuration>
+ <executions>
+ <execution>
+ <id>reserve-port</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.5.3</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*IT.class</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <configuration>
+ <httpConnector>
+ <port>${jetty.port}</port>
+ </httpConnector>
+ <stopKey>quit</stopKey>
+ <stopPort>${jetty.stop.port}</stopPort>
+ <stopWait>10</stopWait>
+ <contextHandlers>
+ <contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
+ <contextPath>/static</contextPath>
+ <resourceBase>${project.build.directory}/maven-shared-archive-resources</resourceBase>
+ <handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
+ </contextHandler>
+ </contextHandlers>
+ <supportedPackagings>jar</supportedPackagings>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <jetty.port>${jetty.port}</jetty.port>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
</project>
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.collectionspace.serivces.blob.StaticImage;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.MediaClient;
import org.collectionspace.services.client.PayloadOutputPart;
* $LastChangedRevision: $
* $LastChangedDate: $
*/
-public class MediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, MediaCommon> {
+public class MediaServiceIT extends AbstractPoxServiceTestImpl<AbstractCommonList, MediaCommon> {
- private final String CLASS_NAME = MediaServiceTest.class.getName();
- private final Logger logger = LoggerFactory.getLogger(MediaServiceTest.class);
- private final static String PUBLIC_URL_DECK = "https://farm8.staticflickr.com/7231/6962564226_4bdfc17599_k_d.jpg";
+ private final Logger logger = LoggerFactory.getLogger(MediaServiceIT.class);
private boolean mediaCleanup = true;
}
- @Override
+ @Override
public String getServicePathComponent() {
return MediaClient.SERVICE_PATH_COMPONENT;
}
public void createMediaAndBlobWithUri(String testName) throws Exception {
MediaClient client = new MediaClient();
PoxPayloadOut multipart = createMediaInstance(createIdentifier());
- Response mediaRes = client.createMediaAndBlobWithUri(multipart, PUBLIC_URL_DECK, true); // purge the original
+ Response mediaRes = client.createMediaAndBlobWithUri(multipart, StaticImage.DECK.getUrl(), true); // purge the original
String mediaCsid = null;
try {
assertStatusCode(mediaRes, testName);
<artifactId>org.collectionspace.services.restrictedmedia.jaxb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.person.client</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services.blob</groupId>
+ <artifactId>blob-test-utils</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- External dependencies -->
<dependency>
<build>
<finalName>collectionspace-services-restrictedmedia-client</finalName>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-remote-resources-plugin</artifactId>
+ <configuration>
+ <resourceBundles>
+ <resourceBundle>org.collectionspace.services.blob:blob-test-utils:${project.version}</resourceBundle>
+ </resourceBundles>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>process</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.6.0</version>
+ <configuration>
+ <portNames>
+ <portName>jetty.port</portName>
+ <portName>jetty.stop.port</portName>
+ </portNames>
+ <fileSet/>
+ <name/>
+ <regex/>
+ <source/>
+ <value/>
+ </configuration>
+ <executions>
+ <execution>
+ <id>reserve-port</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>reserve-network-port</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.5.3</version>
+ <configuration>
+ <excludes>
+ <exclude>**/*IT.class</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-maven-plugin</artifactId>
+ <configuration>
+ <httpConnector>
+ <port>${jetty.port}</port>
+ </httpConnector>
+ <stopKey>quit</stopKey>
+ <stopPort>${jetty.stop.port}</stopPort>
+ <stopWait>10</stopWait>
+ <contextHandlers>
+ <contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
+ <contextPath>/static</contextPath>
+ <resourceBase>${project.build.directory}/maven-shared-archive-resources</resourceBase>
+ <handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
+ </contextHandler>
+ </contextHandlers>
+ <supportedPackagings>jar</supportedPackagings>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <systemPropertyVariables>
+ <jetty.port>${jetty.port}</jetty.port>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
-</project>
\ No newline at end of file
+</project>
import java.util.UUID;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+
+import org.collectionspace.serivces.blob.StaticImage;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.PayloadOutputPart;
import org.collectionspace.services.client.PoxPayloadOut;
/**
* RestrictedMediaServiceTest, carries out tests against a deployed and running Restricted Media Service.
*/
-public class RestrictedMediaServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, RestrictedMediaCommon> {
+public class RestrictedMediaServiceIT extends AbstractPoxServiceTestImpl<AbstractCommonList, RestrictedMediaCommon> {
- private final Logger logger = LoggerFactory.getLogger(RestrictedMediaServiceTest.class);
- private static final String PUBLIC_URL_DECK = "https://farm8.staticflickr.com/7231/6962564226_4bdfc17599_k_d.jpg";
+ private final Logger logger = LoggerFactory.getLogger(RestrictedMediaServiceIT.class);
private boolean mediaCleanup = true;
PoxPayloadOut multipart = createMediaInstance(createIdentifier());
// purge the original
- Response mediaRes = client.createMediaAndBlobWithUri(multipart, PUBLIC_URL_DECK, true);
+ Response mediaRes = client.createMediaAndBlobWithUri(multipart, StaticImage.DECK.getUrl(), true);
String mediaCsid = null;
try {
assertStatusCode(mediaRes, testName);