@Test public void getNamespaces_twoNamespacesStored_shouldReturnTheTwoNamespaces() { createEntityInNamespace(A_NAMESPACE, KIND_NAME, PROPERTY_NAME, A_NAME); createEntityInNamespace(ANOTHER_NAMESPACE, KIND_NAME, PROPERTY_NAME, ANOTHER_NAME); List<AppIdNamespaceDto> namespaceDtoList = namespacesService.getNamespaces(); assertEquals(2, namespaceDtoList.size()); assertEquals(A_NAMESPACE, namespaceDtoList.get(0).getNamespace()); assertEquals(ANOTHER_NAMESPACE, namespaceDtoList.get(1).getNamespace()); }
@Override public List<AppIdNamespaceDto> getNamespaces() { AppEngineHelper.disableApiHooks(); Iterable<Entity> entities = datastoreHelper.getAllNamespaces(); Iterable<AppIdNamespaceDto> namespaces = FluentIterable.from(entities) .transform(new Function<Entity, AppIdNamespaceDto>() { @Override public AppIdNamespaceDto apply(Entity input) { return new AppIdNamespaceDto(input.getAppId(), Entities.getNamespaceFromNamespaceKey(input.getKey())); } }); return Lists.newArrayList(namespaces); }
NamespacesServiceImpl implements NamespacesService { @Override public List<AppIdNamespaceDto> getNamespaces() { AppEngineHelper.disableApiHooks(); Iterable<Entity> entities = datastoreHelper.getAllNamespaces(); Iterable<AppIdNamespaceDto> namespaces = FluentIterable.from(entities) .transform(new Function<Entity, AppIdNamespaceDto>() { @Override public AppIdNamespaceDto apply(Entity input) { return new AppIdNamespaceDto(input.getAppId(), Entities.getNamespaceFromNamespaceKey(input.getKey())); } }); return Lists.newArrayList(namespaces); } }
NamespacesServiceImpl implements NamespacesService { @Override public List<AppIdNamespaceDto> getNamespaces() { AppEngineHelper.disableApiHooks(); Iterable<Entity> entities = datastoreHelper.getAllNamespaces(); Iterable<AppIdNamespaceDto> namespaces = FluentIterable.from(entities) .transform(new Function<Entity, AppIdNamespaceDto>() { @Override public AppIdNamespaceDto apply(Entity input) { return new AppIdNamespaceDto(input.getAppId(), Entities.getNamespaceFromNamespaceKey(input.getKey())); } }); return Lists.newArrayList(namespaces); } @Inject  NamespacesServiceImpl(
            DatastoreHelper datastoreHelper); }
NamespacesServiceImpl implements NamespacesService { @Override public List<AppIdNamespaceDto> getNamespaces() { AppEngineHelper.disableApiHooks(); Iterable<Entity> entities = datastoreHelper.getAllNamespaces(); Iterable<AppIdNamespaceDto> namespaces = FluentIterable.from(entities) .transform(new Function<Entity, AppIdNamespaceDto>() { @Override public AppIdNamespaceDto apply(Entity input) { return new AppIdNamespaceDto(input.getAppId(), Entities.getNamespaceFromNamespaceKey(input.getKey())); } }); return Lists.newArrayList(namespaces); } @Inject  NamespacesServiceImpl(
            DatastoreHelper datastoreHelper); @Override List<AppIdNamespaceDto> getNamespaces(); }
NamespacesServiceImpl implements NamespacesService { @Override public List<AppIdNamespaceDto> getNamespaces() { AppEngineHelper.disableApiHooks(); Iterable<Entity> entities = datastoreHelper.getAllNamespaces(); Iterable<AppIdNamespaceDto> namespaces = FluentIterable.from(entities) .transform(new Function<Entity, AppIdNamespaceDto>() { @Override public AppIdNamespaceDto apply(Entity input) { return new AppIdNamespaceDto(input.getAppId(), Entities.getNamespaceFromNamespaceKey(input.getKey())); } }); return Lists.newArrayList(namespaces); } @Inject  NamespacesServiceImpl(
            DatastoreHelper datastoreHelper); @Override List<AppIdNamespaceDto> getNamespaces();  }