use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.
the class LoadDataInformationBuilderTest method shouldCreateLoadDataInformationWithOutBackupResource.
@Test
public void shouldCreateLoadDataInformationWithOutBackupResource() throws URISyntaxException {
String resourceId = "resourceId";
UpdatePolicy updatePolicy = UpdatePolicy.LAZY;
Map<String, String> properties = new HashMap<>();
LoaderListener loaderListener = new LoaderListener() {
@Override
public void newDataLoaded(String resourceId, InputStream is) {
}
};
URI[] resourceLocations = new URI[] { new URI("localhost") };
LoadDataInformation loadInformation = new LoadDataInformationBuilder().withResourceId(resourceId).withUpdatePolicy(updatePolicy).withProperties(properties).withLoaderListener(loaderListener).withResourceLocations(resourceLocations).build();
assertEquals(loadInformation.getResourceId(), resourceId);
assertEquals(loadInformation.getUpdatePolicy(), updatePolicy);
assertEquals(loadInformation.getProperties(), properties);
assertNull(loadInformation.getBackupResource());
assertEquals(loadInformation.getResourceLocations(), resourceLocations);
assertFalse(loadInformation.isStartRemote());
}
use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.
the class LoadDataInformationBuilderTest method shouldReturnsErrorWhenResourceLocationsWasNotInformed.
@Test(expectedExceptions = IllegalStateException.class)
public void shouldReturnsErrorWhenResourceLocationsWasNotInformed() throws URISyntaxException {
String resourceId = "resourceId";
UpdatePolicy updatePolicy = UpdatePolicy.LAZY;
Map<String, String> properties = new HashMap<>();
LoaderListener loaderListener = new LoaderListener() {
@Override
public void newDataLoaded(String resourceId, InputStream is) {
}
};
new LoadDataInformationBuilder().withResourceId(resourceId).withUpdatePolicy(updatePolicy).withProperties(properties).withLoaderListener(loaderListener).build();
}
use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.
the class LoadDataInformationBuilderTest method shouldCreateLoadDataInformation.
@Test
public void shouldCreateLoadDataInformation() throws URISyntaxException {
String resourceId = "resourceId";
UpdatePolicy updatePolicy = UpdatePolicy.LAZY;
Map<String, String> properties = new HashMap<>();
LoaderListener loaderListener = new LoaderListener() {
@Override
public void newDataLoaded(String resourceId, InputStream is) {
}
};
URI backupResource = new URI("localhost");
URI[] resourceLocations = new URI[] { new URI("localhost") };
LoadDataInformation loadInformation = new LoadDataInformationBuilder().withResourceId(resourceId).withUpdatePolicy(updatePolicy).withProperties(properties).withLoaderListener(loaderListener).withBackupResource(backupResource).withStartRemote(true).withResourceLocations(resourceLocations).build();
assertEquals(loadInformation.getResourceId(), resourceId);
assertEquals(loadInformation.getUpdatePolicy(), updatePolicy);
assertEquals(loadInformation.getProperties(), properties);
assertEquals(loadInformation.getBackupResource(), backupResource);
assertEquals(loadInformation.getResourceLocations(), resourceLocations);
assertTrue(loadInformation.isStartRemote());
}
use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.
the class LoadableResourceBuilderTest method setup.
@BeforeMethod
public void setup() throws URISyntaxException {
String resourceId = "resourceId";
UpdatePolicy updatePolicy = UpdatePolicy.LAZY;
Map<String, String> properties = new HashMap<>();
LoaderListener loaderListener = new LoaderListener() {
@Override
public void newDataLoaded(String resourceId, InputStream is) {
}
};
URI backupResource = new URI("localhost");
URI[] resourceLocations = new URI[] { new URI("localhost") };
loadInformation = new LoadDataInformationBuilder().withResourceId(resourceId).withUpdatePolicy(updatePolicy).withProperties(properties).withLoaderListener(loaderListener).withBackupResource(backupResource).withResourceLocations(resourceLocations).build();
}
use of org.javamoney.moneta.spi.LoaderService.LoaderListener in project jsr354-ri by JavaMoney.
the class LoadDataInformationBuilderTest method shouldReturnsErrorWhenResourceIdWasNotInformed.
@Test(expectedExceptions = IllegalStateException.class)
public void shouldReturnsErrorWhenResourceIdWasNotInformed() throws URISyntaxException {
UpdatePolicy updatePolicy = UpdatePolicy.LAZY;
Map<String, String> properties = new HashMap<>();
LoaderListener loaderListener = new LoaderListener() {
@Override
public void newDataLoaded(String resourceId, InputStream is) {
}
};
URI[] resourceLocations = new URI[] { new URI("localhost") };
new LoadDataInformationBuilder().withUpdatePolicy(updatePolicy).withProperties(properties).withLoaderListener(loaderListener).withResourceLocations(resourceLocations).build();
}
Aggregations