use of com.google.gwt.resources.client.DataResource in project gwt-test-utils by gwt-test-utils.
the class ClientBundleTest method dataResource.
@Test
public void dataResource() {
// Given
DataResource testDataResource = MyClientBundle.INSTANCE.dataResource();
// When
String name = testDataResource.getName();
String url = testDataResource.getSafeUri().asString();
String toString = testDataResource.toString();
// Then
assertThat(name).isEqualTo("dataResource");
assertThat(url).isEqualTo("http://127.0.0.1:8888/gwt_test_utils_module/textResourceXml.xml");
assertThat(toString).isEqualTo("com.googlecode.gwt.test.internal.resources.DataResourceCallback generated for 'com.googlecode.gwt.test.resources.MyClientBundle.dataResource()'");
assertThat(MyClientBundle.INSTANCE.dataResource()).isEqualTo(testDataResource);
}
use of com.google.gwt.resources.client.DataResource in project gerrit by GerritCodeReview.
the class ModeInfo method indexModes.
private static void indexModes(DataResource[] all) {
for (DataResource r : all) {
modeUris.put(r.getName(), r.getSafeUri());
}
JsArray<ModeInfo> modeList = all();
modeList.push(gerrit_commit());
byMime = NativeMap.create();
JsArray<ModeInfo> filtered = JsArray.createArray().cast();
for (ModeInfo m : Natives.asList(modeList)) {
if (modeUris.containsKey(m.mode())) {
filtered.push(m);
for (String mimeType : Natives.asList(m.mimes())) {
byMime.put(mimeType, m);
}
byMime.put(m.mode(), m);
}
}
Collections.sort(Natives.asList(filtered), new Comparator<ModeInfo>() {
@Override
public int compare(ModeInfo a, ModeInfo b) {
return a.name().toLowerCase().compareTo(b.name().toLowerCase());
}
});
setAll(filtered);
}
use of com.google.gwt.resources.client.DataResource in project gwt-test-utils by gwt-test-utils.
the class MyOverridedClientBundleTest method testDataResource_NoOverride.
@Test
public void testDataResource_NoOverride() {
// Given
DataResource testDataResource = MyOverridedClientBundle.INSTANCE.dataResource();
// When
String name = testDataResource.getName();
String url = testDataResource.getSafeUri().asString();
String toString = testDataResource.toString();
// Then
assertThat(name).isEqualTo("dataResource");
assertThat(url).isEqualTo("http://127.0.0.1:8888/gwt_test_utils_module/textResourceXml.xml");
assertThat(toString).isEqualTo("com.googlecode.gwt.test.internal.resources.DataResourceCallback generated for 'com.googlecode.gwt.test.resources.override.MyOverridedClientBundle.dataResource()'");
assertThat(MyOverridedClientBundle.INSTANCE.dataResource()).isEqualTo(testDataResource);
}
use of com.google.gwt.resources.client.DataResource in project playn by threerings.
the class HtmlAssets method getSound.
@Override
public Sound getSound(String path) {
String url = pathPrefix + path;
AutoClientBundleWithLookup clientBundle = getBundle(path);
if (clientBundle != null) {
String key = getKey(path);
DataResource resource = (DataResource) getResource(key, clientBundle);
if (resource != null) {
url = resource.getSafeUri().asString();
}
} else {
url += ".mp3";
}
return adaptSound(url);
}
Aggregations