Skip to content

Commit

Permalink
WIP: 2024/10/15 - 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaladay committed Oct 15, 2024
1 parent 66d2ed0 commit 9d2b476
Show file tree
Hide file tree
Showing 43 changed files with 906 additions and 441 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,12 @@ protected boolean includeResource(ManifestRequest request, String mimeType) {

protected String fetchImageInfo(String url) throws NotFoundException {
logger.debug("Fetching image info {}", url);
Optional<String> imageInfo = Optional.ofNullable(restTemplate.getForObject(url, String.class));
if (imageInfo.isPresent()) {
return imageInfo.get();

try {
return restTemplate.getForObject(url, String.class);
} catch (RestClientException e) {
throw new NotFoundException("Image not found for " + url, e);
}
throw new NotFoundException("Image information not found!");
}

protected URI getImageUri(String url) throws URISyntaxException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public abstract class AbstractManifestServiceTest implements ManifestServiceTest

protected static final String JSON_DIR = "json/";

protected static final String IMAGE_DIR = "image/";

protected static final String IIIF_SERVICE_URL = "http://localhost:9000";

protected static final String IMAGE_SERVICE_URL = "http://localhost:8182/iiif/2";
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/edu/tamu/iiif/service/ManifestServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@
public interface ManifestServiceTest {

public void testGetManifest() throws IOException, URISyntaxException, JSONException;

//public void testGetRepository();

//public void testGetManifestType();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import static org.mockito.Mockito.lenient;

import edu.tamu.iiif.config.model.FedoraPcdmIiifConfig;
import edu.tamu.iiif.service.AbstractManifestServiceTest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.test.mock.mockito.MockBean;

import edu.tamu.iiif.config.model.FedoraPcdmIiifConfig;
import edu.tamu.iiif.service.AbstractManifestServiceTest;

public abstract class AbstractFedoraPcdm extends AbstractManifestServiceTest {

@MockBean
Expand All @@ -19,6 +18,8 @@ public abstract class AbstractFedoraPcdm extends AbstractManifestServiceTest {

protected static final String FEDORA_PCDM_IDENTIFIER = "fedora-pcdm";

protected static final String SIMULATE_FAILURE = "Simulate Failure";

protected void setup(AbstractFedoraPcdmManifestService fedoraPcdmManifestService) {
super.setup(fedoraPcdmManifestService);

Expand Down Expand Up @@ -81,4 +82,38 @@ protected String getRepoBaseUrl() {
return FEDORA_URL + "/";
}

/**
* Get the path to the mock file.
*
* @param dir The sub-directory the file is stored within (must add trailing forward slash).
* @param file The name of the file.
*
* @return The path to the file.
*/
abstract protected String getMockFilePath(String type, String file);

/**
* Setup the mocks.
*
* @throws IOException
*/
abstract protected void setupMocks() throws IOException;


/**
* Get the manifest path for a collection.
*
* @return Path to the manifest.
*/
protected String getManifestCollectionPath() {
return "mwbObjects/TGWCatalog";
}

/**
* Get the manifest path for a page.
*
* @return Path to the manifest.
*/
abstract protected String getManifestPagePath();

}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9d2b476

Please sign in to comment.