You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/09/03 14:32:10 UTC
[19/87] [abbrv] [partial] isis git commit: ISIS-1194: moving the
wicket submodules to be direct children of core;
removing the isis-viewer-wicket parent pom.
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageClassRegistryDefault.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageClassRegistryDefault.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageClassRegistryDefault.java
deleted file mode 100644
index 56550c7..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageClassRegistryDefault.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.registries.pages;
-
-import java.util.Map;
-
-import com.google.common.collect.Maps;
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-
-import org.apache.wicket.Page;
-
-import org.apache.isis.viewer.wicket.model.models.PageType;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassList;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistrySpi;
-
-/**
- * Default implementation of {@link PageClassRegistry}; just delegates to an
- * underlying {@link PageClassList}.
- */
-@Singleton
-public class PageClassRegistryDefault implements PageClassRegistry, PageClassRegistrySpi {
-
- private static final long serialVersionUID = 1L;
-
- private final Map<PageType, Class<? extends Page>> pagesByType = Maps.newHashMap();
-
- /**
- * {@link Inject}ed in {@link #PageClassRegistryDefault(PageClassList)
- * constructor}.
- */
- @SuppressWarnings("unused")
- private final PageClassList pageClassList;
-
- @Inject
- public PageClassRegistryDefault(final PageClassList pageClassList) {
- this.pageClassList = pageClassList;
- pageClassList.registerPages(this);
- ensureAllPageTypesRegistered();
- }
-
- private void ensureAllPageTypesRegistered() {
- for (final PageType pageType : PageType.values()) {
- if (getPageClass(pageType) == null) {
- throw new IllegalStateException("No page registered for " + pageType);
- }
- }
- }
-
- // /////////////////////////////////////////////////////////
- // API
- // /////////////////////////////////////////////////////////
-
- @Override
- public final Class<? extends Page> getPageClass(final PageType pageType) {
- return pagesByType.get(pageType);
- }
-
- // /////////////////////////////////////////////////////////
- // API
- // /////////////////////////////////////////////////////////
-
- @Override
- public final void registerPage(final PageType pageType, final Class<? extends Page> pageClass) {
- pagesByType.put(pageType, pageClass);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageNavigationServiceDefault.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageNavigationServiceDefault.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageNavigationServiceDefault.java
deleted file mode 100644
index ab45158..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/registries/pages/PageNavigationServiceDefault.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.registries.pages;
-
-import com.google.inject.Inject;
-import com.google.inject.Singleton;
-import org.apache.wicket.Page;
-import org.apache.wicket.RestartResponseAtInterceptPageException;
-import org.apache.wicket.RestartResponseException;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.isis.viewer.wicket.model.models.PageType;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
-import org.apache.isis.viewer.wicket.ui.pages.PageNavigationService;
-
-/**
- * Default implementation of {@link org.apache.isis.viewer.wicket.ui.pages.PageNavigationService}
- */
-@Singleton
-public class PageNavigationServiceDefault implements PageNavigationService {
-
- private static final long serialVersionUID = 1L;
-
- private final PageClassRegistry pageClassRegistry;
-
- @Inject
- public PageNavigationServiceDefault(final PageClassRegistry pageClassRegistry) {
- this.pageClassRegistry = pageClassRegistry;
- }
-
- @Override
- public void navigateTo(PageType pageType) {
- navigateTo(pageType, new PageParameters());
- }
-
- @Override
- public void navigateTo(PageType pageType, PageParameters parameters) {
- Class<? extends Page> pageClass = pageClassRegistry.getPageClass(pageType);
- RequestCycle.get().setResponsePage(pageClass, parameters);
- }
-
- @Override
- public void restartAt(PageType pageType) {
- Class<? extends Page> pageClass = pageClassRegistry.getPageClass(pageType);
- throw new RestartResponseException(pageClass);
- }
-
- @Override
- public void interceptAndRestartAt(PageType pageType) {
- Class<? extends Page> pageClass = pageClassRegistry.getPageClass(pageType);
- throw new RestartResponseAtInterceptPageException(pageClass);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/DeepLinkServiceWicket.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/DeepLinkServiceWicket.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/DeepLinkServiceWicket.java
deleted file mode 100644
index a665979..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/DeepLinkServiceWicket.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.services;
-
-import javax.inject.Inject;
-import java.net.URI;
-import java.net.URISyntaxException;
-import org.apache.wicket.Page;
-import org.apache.wicket.request.Url;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.guice.GuiceBeanProvider;
-import org.apache.isis.applib.services.linking.DeepLinkService;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
-import org.apache.isis.viewer.wicket.model.models.EntityModel;
-import org.apache.isis.viewer.wicket.model.models.PageType;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassListDefault;
-
-/**
- * An implementation of {@link org.apache.isis.applib.services.linking.DeepLinkService}
- * for Wicket Viewer
- */
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class DeepLinkServiceWicket implements DeepLinkService {
-
- @Programmatic
- @Override
- public URI deepLinkFor(final Object domainObject) {
-
- final AdapterManagerDefault adapterManager = getAdapterManager();
- final ObjectAdapter objectAdapter = adapterManager.adapterFor(domainObject);
- final PageParameters pageParameters = EntityModel.createPageParameters(objectAdapter);
-
- PageClassRegistry pageClassRegistry = guiceBeanProvider.lookup(PageClassRegistry.class);
- final Class<? extends Page> pageClass = pageClassRegistry.getPageClass(PageType.ENTITY);
-
- final RequestCycle requestCycle = RequestCycle.get();
- final CharSequence urlForPojo = requestCycle.urlFor(pageClass, pageParameters);
- final String fullUrl = requestCycle.getUrlRenderer().renderFullUrl(Url.parse(urlForPojo));
- try {
- return new URI(fullUrl);
- } catch (final URISyntaxException ex) {
- throw new RuntimeException("Cannot create a deep link to domain object: " + domainObject, ex);
- }
- }
-
- protected AdapterManagerDefault getAdapterManager() {
- return getPersistenceSession().getAdapterManager();
- }
-
- protected PersistenceSession getPersistenceSession() {
- return IsisContext.getPersistenceSession();
- }
-
- @Inject
- private GuiceBeanProvider guiceBeanProvider;
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/GuiceBeanProviderWicket.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/GuiceBeanProviderWicket.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/GuiceBeanProviderWicket.java
deleted file mode 100644
index f963ce8..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/GuiceBeanProviderWicket.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.services;
-
-import java.lang.annotation.Annotation;
-import com.google.inject.Injector;
-import com.google.inject.Key;
-import org.apache.wicket.Application;
-import org.apache.wicket.guice.GuiceInjectorHolder;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.guice.GuiceBeanProvider;
-
-/**
- * An implementation of {@link org.apache.isis.applib.services.guice.GuiceBeanProvider}
- * that uses the Injector configured for Wicket
- */
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class GuiceBeanProviderWicket implements GuiceBeanProvider {
-
- @Programmatic
- @Override
- public <T> T lookup(final Class<T> beanType) {
- final Application application = Application.get();
- final GuiceInjectorHolder injectorHolder = application.getMetaData(GuiceInjectorHolder.INJECTOR_KEY);
- final Injector injector = injectorHolder.getInjector();
- return injector.getInstance(beanType);
- }
-
- @Programmatic
- @Override
- public <T> T lookup(final Class<T> beanType, final Annotation qualifier) {
- final Application application = Application.get();
- final GuiceInjectorHolder injectorHolder = application.getMetaData(GuiceInjectorHolder.INJECTOR_KEY);
- final Injector injector = injectorHolder.getInjector();
- return injector.getInstance(Key.get(beanType, qualifier));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/LocaleProviderWicket.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/LocaleProviderWicket.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/LocaleProviderWicket.java
deleted file mode 100644
index 997a4ee..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/LocaleProviderWicket.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.services;
-
-import java.util.Locale;
-import org.apache.wicket.Application;
-import org.apache.wicket.Session;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.i18n.LocaleProvider;
-
-
-/**
- * An implementation that provides the locale of the current session.
- */
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class LocaleProviderWicket implements LocaleProvider {
-
- public static final Logger LOG = LoggerFactory.getLogger(LocaleProviderWicket.class);
-
- @Programmatic
- @Override
- public Locale getLocale() {
- // Request Cycle can be null, e.g. during the start of an application
- RequestCycle requestCycle = RequestCycle.get();
-
- if (!Application.exists() || requestCycle == null) {
- // eg if request from RO viewer
- return null;
- }
- return RequestCycle.get().getRequest().getLocale();
- }
-
- protected Session getSession() {
- return Session.get();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicket.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicket.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicket.java
deleted file mode 100644
index 0cf5e5a..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicket.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.services;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.nio.file.Path;
-import java.util.Collections;
-import java.util.List;
-import java.util.regex.Pattern;
-import javax.servlet.ServletContext;
-import com.google.common.base.Charsets;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.io.CharSource;
-import com.google.common.io.Files;
-import com.google.common.io.Resources;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.isis.applib.annotation.DomainService;
-import org.apache.isis.applib.annotation.NatureOfService;
-import org.apache.isis.applib.annotation.Programmatic;
-import org.apache.isis.applib.services.i18n.TranslationsResolver;
-import org.apache.isis.core.webapp.WebAppConstants;
-import org.apache.isis.viewer.wicket.viewer.IsisWicketApplication;
-
-
-/**
- * An implementation that reads from /WEB-INF/...
- */
-@DomainService(
- nature = NatureOfService.DOMAIN
-)
-public class TranslationsResolverWicket implements TranslationsResolver {
-
- public static Logger LOG = LoggerFactory.getLogger(TranslationsResolverWicket.class);
-
- @Override
- @Programmatic
- public List<String> readLines(final String file) {
- final ServletContext servletContext = getServletContext();
-
- final String configLocation = servletContext.getInitParameter(WebAppConstants.CONFIG_DIR_PARAM);
- try {
- if(configLocation != null) {
- LOG.info( "Reading translations relative to config override location: " + configLocation );
- return Files.readLines(newFile(configLocation, file), Charsets.UTF_8);
- } else {
- final URL url = servletContext.getResource("/WEB-INF/" + file);
- return readLines(url);
- }
- } catch (final RuntimeException | IOException ignored) {
- return null;
- }
- }
-
- static File newFile(final String dir, final String file) {
- final File base = new File(dir);
- final Path path = base.toPath();
- final Path resolve = path.resolve(file);
- return resolve.toFile();
- }
-
- protected ServletContext getServletContext() {
- return getIsisWicketApplication().getServletContext();
- }
-
- private static final Pattern nonEmpty = Pattern.compile("^(#:|msgid|msgstr).+$");
- private static List<String> readLines(final URL url) throws IOException {
- if(url == null) {
- return null;
- }
- final CharSource charSource = Resources.asCharSource(url, Charsets.UTF_8);
- final ImmutableList<String> strings = charSource.readLines();
- return Collections.unmodifiableList(
- Lists.newArrayList(
- Iterables.filter(strings, new Predicate<String>() {
- @Override
- public boolean apply(final String input) {
- return input != null && nonEmpty.matcher(input).matches();
- }
- })));
- }
-
- protected IsisWicketApplication getIsisWicketApplication() {
- return IsisWicketApplication.get();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/IsisResourceSettings.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/IsisResourceSettings.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/IsisResourceSettings.java
deleted file mode 100644
index ddb3da6..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/IsisResourceSettings.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.settings;
-
-import java.util.List;
-import org.apache.wicket.Application;
-import org.apache.wicket.resource.loader.*;
-import org.apache.wicket.settings.def.ResourceSettings;
-import org.apache.wicket.util.lang.Generics;
-
-public class IsisResourceSettings extends ResourceSettings {
-
- /** Chain of string resource loaders to use */
- private final List<IStringResourceLoader> stringResourceLoaders = Generics.newArrayList(4);
-
- /**
- * Configures Wicket's default ResourceLoaders.
- *
- * <p>
- * In contrast to the default lookup strategy, Isis' searches for application-specific properties first.
- *
- * </p>
- * For an example in {@code FooApplication} let {@code bar.Foo} extend {@link org.apache.wicket.Component}, this
- * results in the following ordering:
- * <dl>
- * <dt>application specific</dt>
- * <dd>
- * <ul>
- * <li>FooApplication.properties</li>
- * <li>Application.properties</li>
- * </ul>
- * </dd>
- * <dt>component specific</dt>
- * <dd>
- * <ul>
- * <li>bar/Foo.properties</li>
- * <li>org/apache/wicket/Component.properties</li>
- * </ul>
- * </dd>
- * <dt>package specific</dt>
- * <dd>
- * <ul>
- * <li>bar/package.properties</li>
- * <li>package.properties (on Foo's class loader)</li>
- * <li>org/apache/wicket/package.properties</li>
- * <li>org/apache/package.properties</li>
- * <li>org/package.properties</li>
- * <li>package.properties (on Component's class loader)</li>
- * </ul>
- * </dd>
- * <dt>validator specific</dt>
- * <dt>Initializer specific</dt>
- * <dd>
- * <ul>
- * <li>bar.Foo.properties (Foo implementing IInitializer)</li>
- * </ul>
- * </dd>
- * </dl>
- *
- * @param application
- */
- public IsisResourceSettings(Application application) {
- super(application);
-
- // consult first (the default implementation checks this only third)
- stringResourceLoaders.add(new ClassStringResourceLoader(application.getClass()));
-
- stringResourceLoaders.add(new ComponentStringResourceLoader());
- stringResourceLoaders.add(new PackageStringResourceLoader());
- // this is where the default implementation registered the search.
- //stringResourceLoaders.add(new ClassStringResourceLoader(application.getClass()));
- stringResourceLoaders.add(new ValidatorStringResourceLoader());
- stringResourceLoaders.add(new InitializerStringResourceLoader(application.getInitializers()));
- }
-
- /**
- * @see org.apache.wicket.settings.IResourceSettings#getStringResourceLoaders()
- */
- @Override
- public List<IStringResourceLoader> getStringResourceLoaders()
- {
- return stringResourceLoaders;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/WicketViewerSettingsDefault.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/WicketViewerSettingsDefault.java b/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/WicketViewerSettingsDefault.java
deleted file mode 100644
index 5e01d0b..0000000
--- a/core/viewer-wicket/impl/src/main/java/org/apache/isis/viewer/wicket/viewer/settings/WicketViewerSettingsDefault.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.settings;
-
-import com.google.inject.Singleton;
-
-import org.apache.isis.core.commons.config.IsisConfiguration;
-import org.apache.isis.core.runtime.system.context.IsisContext;
-import org.apache.isis.viewer.wicket.model.isis.WicketViewerSettings;
-import org.apache.isis.viewer.wicket.ui.components.scalars.datepicker.TextFieldWithDatePicker;
-
-@Singleton
-public class WicketViewerSettingsDefault implements WicketViewerSettings {
-
- private static final long serialVersionUID = 1L;
-
- IsisConfiguration getConfiguration() {
- return IsisContext.getConfiguration();
- }
-
- /**
- * The maximum length that a title of an object will be shown when rendered in a standalone table;
- * will be truncated beyond this (with ellipses to indicate the truncation).
- */
- @Override
- public int getMaxTitleLengthInStandaloneTables() {
- return getConfiguration().getInteger("isis.viewer.wicket.maxTitleLengthInStandaloneTables", getMaxTitleLengthInTables());
- }
-
- /**
- * The maximum length that a title of an object will be shown when rendered in a parented table;
- * will be truncated beyond this (with ellipses to indicate the truncation).
- */
- @Override
- public int getMaxTitleLengthInParentedTables() {
- return getConfiguration().getInteger("isis.viewer.wicket.maxTitleLengthInParentedTables", getMaxTitleLengthInTables());
- }
-
- /**
- * Fallback for either {@link #getMaxTitleLengthInParentedTables()} and {@link #getMaxTitleLengthInParentedTables()}
- */
- private int getMaxTitleLengthInTables() {
- return getConfiguration().getInteger("isis.viewer.wicket.maxTitleLengthInTables", 12);
- }
-
- /**
- * The pattern used for rendering and parsing dates.
- */
- @Override
- public String getDatePattern() {
- return getConfiguration().getString("isis.viewer.wicket.datePattern", "dd-MM-yyyy");
- }
-
- /**
- * The pattern used for rendering and parsing date/times.
- */
- @Override
- public String getDateTimePattern() {
- return getConfiguration().getString("isis.viewer.wicket.dateTimePattern", "dd-MM-yyyy HH:mm");
- }
-
- /**
- * The pattern used for rendering and parsing timestamps.
- */
- @Override
- public String getTimestampPattern() {
- return getConfiguration().getString("isis.viewer.wicket.timestampPattern", "yyyy-MM-dd HH:mm:ss.SSS");
- }
-
- /**
- * The pattern used for rendering dates chosen by the {@link TextFieldWithDatePicker}.
- *
- * <p>
- * This pattern is different from {@link #getDatePattern()} because it is interpreted by
- * <a href="https://github.com/Eonasdan/bootstrap-datetimepicker">Bootstrap Datetime Picker</a> component
- * that uses <a href="http://momentjs.com/docs/#/parsing/string-format/">Moment.js formats</a>, rather
- * than by Java code.
- */
- @Override
- public String getDatePickerPattern() {
- return getConfiguration().getString("isis.viewer.wicket.datePickerPattern", "DD-MM-YYYY");
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/main/resources/log4j.properties b/core/viewer-wicket/impl/src/main/resources/log4j.properties
deleted file mode 100644
index f275d06..0000000
--- a/core/viewer-wicket/impl/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,28 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-log4j.appender.Stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.Stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.Stdout.layout.conversionPattern=%-5p - %-26.26c{1} - %m\n
-
-log4j.rootLogger=INFO,Stdout
-
-log4j.logger.org.apache.wicket=INFO
-log4j.logger.org.apache.wicket.protocol.http.HttpSessionStore=INFO
-log4j.logger.org.apache.wicket.version=INFO
-log4j.logger.org.apache.wicket.RequestCycle=INFO
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Defaults.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Defaults.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Defaults.java
deleted file mode 100644
index 904d74c..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Defaults.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import org.apache.wicket.IConverterLocator;
-import org.apache.wicket.authroles.authentication.AuthenticatedWebSession;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.model.mementos.ObjectAdapterMemento;
-import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
-
-public class IsisWicketApplication_Defaults {
-
- @Rule
- public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private IsisWicketApplication application;
-
- @Before
- public void setUp() throws Exception {
- application = new IsisWicketApplication();
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void usesCustomSubclassOfAuthenticatedWebSession() {
- final Class<? extends AuthenticatedWebSession> webSessionClass = application.getWebSessionClass();
- assertThat(webSessionClass.equals(AuthenticatedWebSessionForIsis.class), is(true));
- }
-
- @Ignore // 6.0.0 does it differently
- @Test
- public void providesCustomRequestCycle() {
-// final WebRequest mockRequest = context.mock(WebRequest.class);
-// final Response mockResponse = context.mock(Response.class);
-// final RequestCycle newRequestCycle = application.newRequestCycle(mockRequest, mockResponse);
-// assertThat(newRequestCycle, is(WebRequestCycleForIsis.class));
- }
-
- @Test
- public void providesConverterLocatorRegistersIsisSpecificConverters() {
- final IConverterLocator converterLocator = application.newConverterLocator();
- assertThat(converterLocator.getConverter(ObjectAdapter.class), is(not(nullValue())));
- assertThat(converterLocator.getConverter(ObjectAdapterMemento.class), is(not(nullValue())));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Pages.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Pages.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Pages.java
deleted file mode 100644
index 5e754b0..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicketApplication_Pages.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.WebPage;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.model.models.PageType;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
-import org.apache.isis.viewer.wicket.ui.pages.home.HomePage;
-
-public class IsisWicketApplication_Pages {
-
- @Rule
- public JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_ONLY);
-
- @Mock
- private PageClassRegistry mockPageClassRegistry;
-
- private IsisWicketApplication application;
-
- @Test
- public void delegatesToPageClassRegistryToObtainPageTypes() {
- final PageType pageType = PageType.HOME;
- final Class<HomePage> expectedPageClass = HomePage.class;
-
- application = new IsisWicketApplication() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public PageClassRegistry getPageClassRegistry() {
- return mockPageClassRegistry;
- }
-
- };
- context.checking(new Expectations() {
- {
- one(mockPageClassRegistry).getPageClass(pageType);
- will(returnValue(expectedPageClass));
- }
- });
- final Class<? extends Page> pageClass = application.getHomePage();
- assertThat(expectedPageClass.isAssignableFrom(pageClass), is(true));
- }
-
- @Test
- public void delegatesToPageClassRegistryToObtainPageTypes_ForSignIn() {
-
- final PageType pageType = PageType.SIGN_IN;
- final Class<WebPage> expectedPageClass = WebPage.class;
-
- final PageClassRegistry mockPageClassRegistry = context.mock(PageClassRegistry.class);
- application = new IsisWicketApplication() {
- private static final long serialVersionUID = 1L;
-
- @Override
- public PageClassRegistry getPageClassRegistry() {
- return mockPageClassRegistry;
- }
- };
- context.checking(new Expectations() {
- {
- one(mockPageClassRegistry).getPageClass(pageType);
- will(returnValue(expectedPageClass));
- }
- });
- final Class<? extends Page> pageClass = application.getSignInPageClass();
- assertThat(expectedPageClass.isAssignableFrom(pageClass), is(true));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicket_providers.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicket_providers.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicket_providers.java
deleted file mode 100644
index 2dda4ef..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/IsisWicket_providers.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import org.apache.isis.core.commons.config.IsisConfigurationBuilder;
-import org.apache.isis.core.runtime.system.DeploymentType;
-import org.apache.isis.core.runtime.system.IsisSystem;
-
-public class IsisWicket_providers {
-
- private IsisWicketModule isisWicketModule;
- private Injector injector;
-
- @Before
- public void setUp() throws Exception {
- isisWicketModule = new IsisWicketModule();
- injector = Guice.createInjector(isisWicketModule);
- }
-
- @Ignore // REVIEW: DKH
- @Test
- public void deploymentType() {
- final DeploymentType instance = injector.getInstance(DeploymentType.class);
- assertThat(instance, is(notNullValue()));
- }
-
- @Ignore // REVIEW: DKH
- @Test
- public void configurationBuilder() {
- final IsisConfigurationBuilder instance = injector.getInstance(IsisConfigurationBuilder.class);
- assertThat(instance, is(notNullValue()));
- }
-
- @Ignore
- // need to handle config
- @Test
- public void isisSystem() {
- final IsisSystem instance = injector.getInstance(IsisSystem.class);
- assertThat(instance, is(notNullValue()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/WicketObjectModule_bindingsStandard.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/WicketObjectModule_bindingsStandard.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/WicketObjectModule_bindingsStandard.java
deleted file mode 100644
index 6121101..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/WicketObjectModule_bindingsStandard.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer;
-
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-
-import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistrar;
-import org.apache.isis.viewer.wicket.ui.app.registry.ComponentFactoryRegistry;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassList;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistry;
-import org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistrarDefault;
-import org.apache.isis.viewer.wicket.viewer.registries.components.ComponentFactoryRegistryDefault;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassListDefault;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassRegistryDefault;
-
-@RunWith(Parameterized.class)
-public class WicketObjectModule_bindingsStandard {
-
- private IsisWicketModule wicketObjectsModule;
- private Injector injector;
- private final Class<?> from;
- private final Class<?> to;
-
- @Parameters
- public static Collection<Object[]> params() {
- return Arrays.asList(new Object[][] { { ComponentFactoryRegistrar.class, ComponentFactoryRegistrarDefault.class }, { ComponentFactoryRegistry.class, ComponentFactoryRegistryDefault.class }, { PageClassList.class, PageClassListDefault.class },
- { PageClassRegistry.class, PageClassRegistryDefault.class }, });
- }
-
- public WicketObjectModule_bindingsStandard(final Class<?> from, final Class<?> to) {
- this.from = from;
- this.to = to;
- }
-
- @Before
- public void setUp() throws Exception {
- wicketObjectsModule = new IsisWicketModule();
- injector = Guice.createInjector(wicketObjectsModule);
- }
-
- @Test
- public void binding() {
- final Object instance = injector.getInstance(from);
- assertThat(instance, is(instanceOf(to)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Authenticate.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Authenticate.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Authenticate.java
deleted file mode 100644
index 2ecd81c..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Authenticate.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.app.wicket;
-
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-import java.util.Locale;
-
-import org.apache.wicket.request.Request;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
-
-public class AuthenticatedWebSessionForIsis_Authenticate {
-
- @Rule
- public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private AuthenticatedWebSessionForIsis webSession;
- @Mock
- private Request stubRequest;
- @Mock
- private AuthenticationManager mockAuthMgr;
-
- @Before
- public void setUp() throws Exception {
- context.checking(new Expectations() {
- {
- // must provide explicit expectation, since Locale is final.
- allowing(stubRequest).getLocale();
- will(returnValue(Locale.getDefault()));
-
- // stub everything else out
- ignoring(stubRequest);
- }
- });
-
- }
-
- @Test
- public void delegatesToAuthenticationManagerAndCachesAuthSessionIfOk() {
-
- context.checking(new Expectations() {
- {
- one(mockAuthMgr).authenticate(with(any(AuthenticationRequest.class)));
- }
- });
-
- webSession = new AuthenticatedWebSessionForIsis(stubRequest) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected AuthenticationManager getAuthenticationManager() {
- return mockAuthMgr;
- }
- };
- assertThat(webSession.authenticate("jsmith", "secret"), is(true));
- assertThat(webSession.getAuthenticationSession(), is(not(nullValue())));
- }
-
- @Test
- public void delegatesToAuthenticationManagerAndHandlesIfNotAuthenticated() {
- context.checking(new Expectations() {
- {
- one(mockAuthMgr).authenticate(with(any(AuthenticationRequest.class)));
- will(returnValue(null));
- }
- });
- webSession = new AuthenticatedWebSessionForIsis(stubRequest) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected AuthenticationManager getAuthenticationManager() {
- return mockAuthMgr;
- }
- };
- assertThat(webSession.authenticate("jsmith", "secret"), is(false));
- assertThat(webSession.getAuthenticationSession(), is(nullValue()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_DownCastsInheritedFunctionality.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_DownCastsInheritedFunctionality.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_DownCastsInheritedFunctionality.java
deleted file mode 100644
index 7d5b133..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_DownCastsInheritedFunctionality.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.app.wicket;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class AuthenticatedWebSessionForIsis_DownCastsInheritedFunctionality {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Ignore("thread-safe downcast of inherited functionality")
- @Test
- public void testGet() {
- }
-
- @Ignore("thread-safe downcast of inherited functionality")
- @Test
- public void testGetClientInfo() {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Instantiation.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Instantiation.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Instantiation.java
deleted file mode 100644
index 4f5c860..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_Instantiation.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.app.wicket;
-
-import java.util.Locale;
-
-import org.apache.wicket.request.Request;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
-
-public class AuthenticatedWebSessionForIsis_Instantiation {
-
- @Rule
- public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- @Mock
- private Request stubRequest;
-
- @Test
- public void canInstantiateIfProvideRequest() {
- context.checking(new Expectations() {
- {
- // must provide explicit expectation, since Locale is final.
- allowing(stubRequest).getLocale();
- will(returnValue(Locale.getDefault()));
-
- // stub everything else out
- ignoring(stubRequest);
- }
- });
-
- new AuthenticatedWebSessionForIsis(stubRequest);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void requestMustBeProvided() {
- new AuthenticatedWebSessionForIsis(null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_NotYetImplemented.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_NotYetImplemented.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_NotYetImplemented.java
deleted file mode 100644
index 8c4f56b..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_NotYetImplemented.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.app.wicket;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class AuthenticatedWebSessionForIsis_NotYetImplemented {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Ignore("not yet implemented")
- @Test
- public void testIsDebugMode() {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_SignIn.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_SignIn.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_SignIn.java
deleted file mode 100644
index a06abe4..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/app/wicket/AuthenticatedWebSessionForIsis_SignIn.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.app.wicket;
-
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
-import java.util.Locale;
-
-import org.apache.wicket.request.Request;
-import org.jmock.Expectations;
-import org.jmock.auto.Mock;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import org.apache.isis.core.runtime.authentication.AuthenticationManager;
-import org.apache.isis.core.runtime.authentication.AuthenticationRequest;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2;
-import org.apache.isis.core.unittestsupport.jmocking.JUnitRuleMockery2.Mode;
-import org.apache.isis.viewer.wicket.viewer.integration.wicket.AuthenticatedWebSessionForIsis;
-
-public class AuthenticatedWebSessionForIsis_SignIn {
-
- @Rule
- public final JUnitRuleMockery2 context = JUnitRuleMockery2.createFor(Mode.INTERFACES_AND_CLASSES);
-
- private AuthenticatedWebSessionForIsis webSession;
- @Mock
- private Request stubRequest;
- @Mock
- private AuthenticationManager mockAuthMgr;
-
- @Before
- public void setUp() throws Exception {
- context.checking(new Expectations() {
- {
- // must provide explicit expectation, since Locale is final.
- allowing(stubRequest).getLocale();
- will(returnValue(Locale.getDefault()));
-
- // stub everything else out
- ignoring(stubRequest);
- }
- });
-
- }
-
- @Test
- public void signInJustDelegatesToAuthenticateAndSavesState() {
- context.checking(new Expectations() {
- {
- one(mockAuthMgr).authenticate(with(any(AuthenticationRequest.class)));
- }
- });
-
- webSession = new AuthenticatedWebSessionForIsis(stubRequest) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected AuthenticationManager getAuthenticationManager() {
- return mockAuthMgr;
- }
- };
- webSession.signIn("john", "secret");
- assertThat(webSession.isSignedIn(), is(true));
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/imagecache/ImageResourceCacheKeyTest.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/imagecache/ImageResourceCacheKeyTest.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/imagecache/ImageResourceCacheKeyTest.java
deleted file mode 100644
index 90c95e6..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/imagecache/ImageResourceCacheKeyTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.imagecache;
-
-import java.util.Iterator;
-import java.util.List;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.*;
-
-public class ImageResourceCacheKeyTest {
-
- ImageResourceCacheKey key;
-
- public static class SomeSuperclass {
- }
-
- public static class SomeSubclass extends SomeSuperclass {
- }
-
- public static class SomeOtherContextClass extends SomeSuperclass {
- }
-
-
- public static class SuperKey extends ImageResourceCacheKeyTest {
-
- @Test
- public void whenSubclass() throws Exception {
-
- key = new ImageResourceCacheKey(SomeSubclass.class, "foo");
- final ImageResourceCacheKey superKey = key.superKey();
-
- assertEquals(SomeSuperclass.class, superKey.getResourceClass());
- assertEquals("foo", key.getResourceName());
- }
-
- @Test
- public void whenSuperClass() throws Exception {
-
- key = new ImageResourceCacheKey(SomeSuperclass.class, null);
- final ImageResourceCacheKey superKey = key.superKey();
-
- assertNull(superKey);
- }
-
- }
-
- public static class ResourcePaths extends ImageResourceCacheKeyTest {
-
- @Test
- public void withIconName() throws Exception {
- key = new ImageResourceCacheKey(SomeSubclass.class, "foo");
-
- final List<ImageResourceCacheKey> keys = key.resourcePaths("png", "jpg", "jpeg");
-
- final Iterator<ImageResourceCacheKey> iterator = keys.iterator();
-
- assertNext(iterator, SomeSubclass.class, "SomeSubclass-foo.png");
- assertNext(iterator, SomeSubclass.class, "SomeSubclass-foo.jpg");
- assertNext(iterator, SomeSubclass.class, "SomeSubclass-foo.jpeg");
-
- assertNext(iterator, SomeSubclass.class, "foo.png");
- assertNext(iterator, SomeSubclass.class, "foo.jpg");
- assertNext(iterator, SomeSubclass.class, "foo.jpeg");
-
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass-foo.png");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass-foo.jpg");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass-foo.jpeg");
-
- assertNext(iterator, SomeSuperclass.class, "foo.png");
- assertNext(iterator, SomeSuperclass.class, "foo.jpg");
- assertNext(iterator, SomeSuperclass.class, "foo.jpeg");
-
- assertNext(iterator, null, "SomeSubclass-foo.png");
- assertNext(iterator, null, "SomeSubclass-foo.jpg");
- assertNext(iterator, null, "SomeSubclass-foo.jpeg");
-
- assertNext(iterator, null, "SomeSuperclass-foo.png");
- assertNext(iterator, null, "SomeSuperclass-foo.jpg");
- assertNext(iterator, null, "SomeSuperclass-foo.jpeg");
-
- assertNext(iterator, null, "foo.png");
- assertNext(iterator, null, "foo.jpg");
- assertNext(iterator, null, "foo.jpeg");
-
- assertNext(iterator, SomeSubclass.class, "SomeSubclass.png");
- assertNext(iterator, SomeSubclass.class, "SomeSubclass.jpg");
- assertNext(iterator, SomeSubclass.class, "SomeSubclass.jpeg");
-
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.png");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpg");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpeg");
-
- assertNext(iterator, null, "SomeSubclass.png");
- assertNext(iterator, null, "SomeSubclass.jpg");
- assertNext(iterator, null, "SomeSubclass.jpeg");
-
- assertNext(iterator, null, "SomeSuperclass.png");
- assertNext(iterator, null, "SomeSuperclass.jpg");
- assertNext(iterator, null, "SomeSuperclass.jpeg");
-
- assertNext(iterator, null, "Default.png");
- assertNext(iterator, null, "Default.jpg");
- assertNext(iterator, null, "Default.jpeg");
-
- }
-
- @Test
- public void withoutIconName() throws Exception {
- key = new ImageResourceCacheKey(SomeSubclass.class, null);
-
- final List<ImageResourceCacheKey> keys = key.resourcePaths("png", "jpg", "jpeg");
-
- final Iterator<ImageResourceCacheKey> iterator = keys.iterator();
-
- assertNext(iterator, SomeSubclass.class, "SomeSubclass.png");
- assertNext(iterator, SomeSubclass.class, "SomeSubclass.jpg");
- assertNext(iterator, SomeSubclass.class, "SomeSubclass.jpeg");
-
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.png");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpg");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpeg");
-
- assertNext(iterator, null, "SomeSubclass.png");
- assertNext(iterator, null, "SomeSubclass.jpg");
- assertNext(iterator, null, "SomeSubclass.jpeg");
-
- assertNext(iterator, null, "SomeSuperclass.png");
- assertNext(iterator, null, "SomeSuperclass.jpg");
- assertNext(iterator, null, "SomeSuperclass.jpeg");
-
- assertNext(iterator, null, "Default.png");
- assertNext(iterator, null, "Default.jpg");
- assertNext(iterator, null, "Default.jpeg");
-
- }
-
- @Test
- public void withoutClass() throws Exception {
- key = new ImageResourceCacheKey(null, "foo");
-
- final List<ImageResourceCacheKey> keys = key.resourcePaths("png", "jpg", "jpeg");
-
- final Iterator<ImageResourceCacheKey> iterator = keys.iterator();
-
- assertNext(iterator, null, "foo.png");
- assertNext(iterator, null, "foo.jpg");
- assertNext(iterator, null, "foo.jpeg");
-
- assertNext(iterator, null, "Default.png");
- assertNext(iterator, null, "Default.jpg");
- assertNext(iterator, null, "Default.jpeg");
- }
-
- /**
- * This what we see for repositories (using <code></code>@DomainService(repositoryFor=...))
- */
- @Test
- public void withoutClassButIconNameSpecifyingADifferentContextClassAndClassName() throws Exception {
- key = new ImageResourceCacheKey(SomeOtherContextClass.class, SomeSuperclass.class.getName());
-
- final List<ImageResourceCacheKey> keys = key.resourcePaths("png", "jpg", "jpeg");
-
- final Iterator<ImageResourceCacheKey> iterator = keys.iterator();
-
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.png");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpg");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpeg");
-
- assertNext(iterator, null, "Default.png");
- assertNext(iterator, null, "Default.jpg");
- assertNext(iterator, null, "Default.jpeg");
-
- }
-
- @Test
- public void withoutClassButIconNameSpecifyingAClassName() throws Exception {
- key = new ImageResourceCacheKey(null, SomeSuperclass.class.getName());
-
- final List<ImageResourceCacheKey> keys = key.resourcePaths("png", "jpg", "jpeg");
-
- final Iterator<ImageResourceCacheKey> iterator = keys.iterator();
-
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.png");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpg");
- assertNext(iterator, SomeSuperclass.class, "SomeSuperclass.jpeg");
-
- assertNext(iterator, null, "Default.png");
- assertNext(iterator, null, "Default.jpg");
- assertNext(iterator, null, "Default.jpeg");
-
- }
-
- private static void assertNext(Iterator<ImageResourceCacheKey> iterator, Class<?> resourceClass, String resourceName) {
- assertThat(iterator.hasNext(), is(true));
- final ImageResourceCacheKey next = iterator.next();
- assertEquals(resourceClass, next.getResourceClass());
- assertEquals(resourceName, next.getResourceName());
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_Instantiation.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_Instantiation.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_Instantiation.java
deleted file mode 100644
index 4861d62..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_Instantiation.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.pages;
-
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JMock;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import org.apache.isis.viewer.wicket.ui.pages.PageClassList;
-import org.apache.isis.viewer.wicket.ui.pages.PageClassRegistrySpi;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassListDefault;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassRegistryDefault;
-
-@RunWith(JMock.class)
-public class PageClassListDefault_Instantiation {
-
- private final Mockery context = new JUnit4Mockery();
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void shouldCauseAllPagesToBeRegistered() {
- // necessary to provide an implementation that will register
- // all pages with the registry.
- final PageClassListDefault pageClassList = new PageClassListDefault();
- new PageClassRegistryDefault(pageClassList);
- }
-
- @Test(expected = IllegalStateException.class)
- public void shouldFailIfNoPagesRegistered() {
- // no side effects, ie doesn't register
- final PageClassList mockPageClassList = context.mock(PageClassList.class);
- context.checking(new Expectations() {
- {
- mockPageClassList.registerPages(with(any(PageClassRegistrySpi.class)));
- }
- });
- new PageClassRegistryDefault(mockPageClassList);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_RegistrationAndCaching.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_RegistrationAndCaching.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_RegistrationAndCaching.java
deleted file mode 100644
index b482435..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/pages/PageClassListDefault_RegistrationAndCaching.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.viewer.pages;
-
-import org.apache.wicket.Page;
-import org.junit.Before;
-import org.junit.Test;
-import org.apache.isis.viewer.wicket.model.models.ActionModel;
-import org.apache.isis.viewer.wicket.model.models.PageType;
-import org.apache.isis.viewer.wicket.ui.pages.actionprompt.ActionPromptPage;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassListDefault;
-import org.apache.isis.viewer.wicket.viewer.registries.pages.PageClassRegistryDefault;
-
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.Matchers.nullValue;
-import static org.junit.Assert.assertThat;
-
-public class PageClassListDefault_RegistrationAndCaching {
-
- private PageClassRegistryDefault registryImpl;
-
- @Before
- public void setUp() throws Exception {
- // necessary to provide an implementation that will register
- // all pages with the registry.
- final PageClassListDefault pageClassList = new PageClassListDefault();
- registryImpl = new PageClassRegistryDefault(pageClassList);
- }
-
- @Test
- public void cachesPageByPageType() {
- final Class<? extends Page> pageClass = registryImpl.getPageClass(PageType.ACTION_PROMPT);
- assertThat(pageClass, is(not(nullValue())));
- }
-
- @Test
- public void canRegisterNewPageType() {
- class TestingActionPage extends ActionPromptPage {
- TestingActionPage() {
- super((ActionModel) null);
- }
- }
- registryImpl.registerPage(PageType.ACTION_PROMPT, TestingActionPage.class);
-
- final Class<? extends Page> pageClass = registryImpl.getPageClass(PageType.ACTION_PROMPT);
- assertThat(pageClass, is(instanceOf(TestingActionPage.class)));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicketTest.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicketTest.java b/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicketTest.java
deleted file mode 100644
index 1027a93..0000000
--- a/core/viewer-wicket/impl/src/test/java/org/apache/isis/viewer/wicket/viewer/services/TranslationsResolverWicketTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.isis.viewer.wicket.viewer.services;
-
-import java.io.File;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assume.assumeThat;
-
-public class TranslationsResolverWicketTest {
-
- public static class NewFile extends TranslationsResolverWicketTest {
-
- @Before
- public void setUp() throws Exception {
- assumeThat(System.getProperty("os.name").startsWith("Windows"), is(true));
- }
-
- @Test
- public void simple() throws Exception {
- final File file = TranslationsResolverWicket.newFile("c:/foo", "bar");
- final String absolutePath = file.getAbsolutePath();
- assertThat(absolutePath, is("c:\\foo\\bar"));
- }
-
- @Test
- public void nestedChild() throws Exception {
- final File file = TranslationsResolverWicket.newFile("c:/foo", "bar/baz");
- final String absolutePath = file.getAbsolutePath();
- assertThat(absolutePath, is("c:\\foo\\bar\\baz"));
- }
-
- }
-
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/pom.xml
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/pom.xml b/core/viewer-wicket/model/pom.xml
deleted file mode 100644
index f600826..0000000
--- a/core/viewer-wicket/model/pom.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<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.apache.isis.core</groupId>
- <artifactId>isis</artifactId>
- <version>1.10.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <artifactId>isis-viewer-wicket-model</artifactId>
- <name>Isis Wicket Viewer Model</name>
-
- <properties>
- <siteBaseDir>..</siteBaseDir>
- <relativeUrl>model/</relativeUrl>
- </properties>
-
- <!-- used in Site generation for relative references. -->
- <url>http://isis.apache.org/${relativeUrl}</url>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.isis.viewer</groupId>
- <artifactId>isis-viewer-wicket-applib</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.wicket</groupId>
- <artifactId>wicket-extensions</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-metamodel</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-runtime</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.isis.core</groupId>
- <artifactId>isis-core-unittestsupport</artifactId>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
-</project>
http://git-wip-us.apache.org/repos/asf/isis/blob/99094b7e/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java
----------------------------------------------------------------------
diff --git a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java b/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java
deleted file mode 100644
index 71b1e71..0000000
--- a/core/viewer-wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/common/OnConcurrencyExceptionHandler.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.isis.viewer.wicket.model.common;
-
-import java.io.Serializable;
-import org.apache.wicket.Component;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
-import org.apache.isis.core.metamodel.adapter.version.ConcurrencyException;
-
-/**
- * Decouples the handling of concurrency exceptions when a bulk action is invoked (between the toggle box column and the
- * standalone collection panel).
- */
-public interface OnConcurrencyExceptionHandler extends Serializable {
-
- void onConcurrencyException(
- Component context, ObjectAdapter selectedAdapter,
- ConcurrencyException ex,
- AjaxRequestTarget ajaxRequestTarget);
-
-}
\ No newline at end of file