You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/12/10 13:44:03 UTC
[isis] branch master updated: ISIS-2473: cleaning up files no
longer needed
This is an automated email from the ASF dual-hosted git repository.
ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/master by this push:
new 5bd09b3 ISIS-2473: cleaning up files no longer needed
5bd09b3 is described below
commit 5bd09b332dab40f717590dc9fd51ed4f6dab1381
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu Dec 10 14:43:50 2020 +0100
ISIS-2473: cleaning up files no longer needed
---
.../isis/tooling/cli/test/doclet/AdocletTest.java | 9 +-
.../ExecutionContext.java => ProjectSampler.java} | 18 +-
.../cli/test/doclet/samples/FactoryService.java | 219 ---------------------
.../cli/test/doclet/samples/RoleMemento.java | 68 -------
.../cli/test/doclet/samples/SudoService.java | 29 ---
.../cli/test/doclet/samples/UserMemento.java | 190 ------------------
.../cli/test/doclet/samples/UserService.java | 93 ---------
7 files changed, 20 insertions(+), 606 deletions(-)
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/AdocletTest.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/AdocletTest.java
index f18aef7..e9a1011 100644
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/AdocletTest.java
+++ b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/AdocletTest.java
@@ -18,8 +18,6 @@
*/
package org.apache.isis.tooling.cli.test.doclet;
-import java.io.File;
-
import org.junit.jupiter.api.Test;
import org.apache.isis.tooling.cli.doclet.AdocletContext;
@@ -35,9 +33,10 @@ class AdocletTest {
@Test
void testJavaDocMining() {
-
- val projDir = new File("./").getAbsoluteFile();
- val analyzerConfig = AnalyzerConfigFactory.mavenTest(projDir, Language.JAVA).main();
+
+ val analyzerConfig = AnalyzerConfigFactory
+ .maven(ProjectSampler.apacheIsisApplib(), Language.JAVA)
+ .main();
val docletContext = AdocletContext
//.javaSourceWithFootNotesFormat()
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/ExecutionContext.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/ProjectSampler.java
similarity index 65%
rename from tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/ExecutionContext.java
rename to tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/ProjectSampler.java
index 92dee61..4187eec 100644
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/ExecutionContext.java
+++ b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/ProjectSampler.java
@@ -16,8 +16,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.isis.tooling.cli.test.doclet.samples;
+package org.apache.isis.tooling.cli.test.doclet;
-public class ExecutionContext {
+import java.io.File;
+final class ProjectSampler {
+
+ static File local() {
+ return new File("./").getAbsoluteFile();
+ }
+
+ static File apacheIsisRoot() {
+ return new File("./").getAbsoluteFile().getParentFile().getParentFile().getParentFile();
+ }
+
+ static File apacheIsisApplib() {
+ return new File(apacheIsisRoot(), "api/applib");
+ }
+
}
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/FactoryService.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/FactoryService.java
deleted file mode 100644
index 8014cdf..0000000
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/FactoryService.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.tooling.cli.test.doclet.samples;
-
-import java.util.NoSuchElementException;
-
-import javax.annotation.Nullable;
-
-import org.apache.isis.commons.exceptions.IsisException;
-
-import lombok.NonNull;
-
-/**
- *
- * @since 2.x {@index}
- *
- */
-//tag::refguide[]
-public interface FactoryService {
-
- // end::refguide[]
- /**
- * General purpose factory method, to automatically get or create an instance of
- * {@code requiredType}.
- *
- * <p>
- * Maps onto one of the specialized factory methods {@link #get(Class)} or {@link #create(Class)}
- * based on the type's meta-data.
- * </p>
- *
- * @param <T>
- * @param requiredType
- * @return
- * @throws NoSuchElementException if result is empty
- * @throws IsisException if instance creation failed
- * @throws IllegalArgumentException if requiredType is not recognized by the meta-model
- *
- * @since 2.0
- *
- */
- // tag::refguide[]
- <T> T getOrCreate(@NonNull Class<T> requiredType); // <.>
-
- // end::refguide[]
- /**
- * Gets an instance (possibly shared or independent) of the specified {@code requiredType},
- * with injection points resolved
- * and any life-cycle callback processed.
- *
- * @param <T>
- * @param requiredType - only applicable to IoC container managed types
- * @return (non-null), an instance of {@code requiredType}, if available and unique
- * (i.e. not multiple candidates found with none marked as primary)
- *
- * @throws NoSuchElementException if result is empty
- * @throws IsisException if instance creation failed
- *
- * @apiNote does not force the requiredType to be added to the meta-model
- * @since 2.0
- */
- // tag::refguide[]
- <T> T get(@NonNull Class<T> requiredType); // <.>
-
- // end::refguide[]
- /**
- * Creates a new detached entity instance, with injection points resolved
- * and defaults applied.
- *
- * @param <T>
- * @param domainClass - only applicable to entity types
- * @return
- * @throws IllegalArgumentException if domainClass is not an entity type
- * @apiNote forces the domainClass to be added to the meta-model if not already
- * @since 2.0
- */
- // tag::refguide[]
- <T> T detachedEntity(@NonNull Class<T> domainClass); // <.>
-
- // end::refguide[]
- /**
- * Creates a new detached entity instance, with injection points resolved.
- *
- * @param <T>
- * @param entity - most likely just new-ed up, without injection points resolved
- * @return
- * @throws IllegalArgumentException if domainClass is not an entity type
- * @apiNote forces the domainClass to be added to the meta-model if not already
- * @since 2.0
- */
- // tag::refguide[]
- <T> T detachedEntity(@NonNull T entity); // <.>
-
- // end::refguide[]
- /**
- * Creates a new Mixin instance, with injection points resolved.
- *
- * @param <T>
- * @param mixinClass
- * @param mixedIn
- * @return
- * @throws IllegalArgumentException if mixinClass is not a mixin type
- * @apiNote forces the mixinClass to be added to the meta-model if not already
- */
- // tag::refguide[]
- <T> T mixin(@NonNull Class<T> mixinClass, @NonNull Object mixedIn); // <.>
-
- // end::refguide[]
- /**
- * Creates a new ViewModel instance, with injection points resolved,
- * and initialized according to the given {@code mementoStr}
- *
- * @param viewModelClass
- * @param mementoStr - ignored if {@code null}
- * @throws IllegalArgumentException if viewModelClass is not a viewmodel type
- * @apiNote forces the viewModelClass to be added to the meta-model if not already
- * @since 2.0
- */
- // tag::refguide[]
- <T> T viewModel(@NonNull Class<T> viewModelClass, @Nullable String mementoStr); // <.>
-
- // end::refguide[]
- /**
- * Creates a new ViewModel instance,
- * with injection points resolved
- * and defaults applied.
- * @param viewModelClass
- * @throws IllegalArgumentException if viewModelClass is not a viewmodel type
- * @apiNote forces the viewModelClass to be added to the meta-model if not already
- * @since 2.0
- */
- // tag::refguide[]
- default <T> T viewModel(@NonNull Class<T> viewModelClass) { // <.>
- return viewModel(viewModelClass, /*mementoStr*/null);
- }
-
- // end::refguide[]
- /**
- * Resolves injection points for given ViewModel instance.
- * @param viewModel - most likely just new-ed up, without injection points resolved
- * @throws IllegalArgumentException if viewModelClass is not a viewmodel type
- * @apiNote forces the viewModel's class to be added to the meta-model if not already
- * @since 2.0
- */
- // tag::refguide[]
- <T> T viewModel(@NonNull T viewModel); // <.>
-
- // end::refguide[]
- /**
- * Creates a new instance of the specified class,
- * with injection points resolved
- * and defaults applied.
- * @param domainClass - not applicable to IoC container managed types
- * @throws IllegalArgumentException if domainClass is an IoC container managed type,
- * or not recognized by the meta-model
- * @apiNote forces the domainClass to be added to the meta-model if not already
- * @since 2.0
- */
- // tag::refguide[]
- <T> T create(@NonNull Class<T> domainClass); // <.>
- // end::refguide[]
-
- // -- DEPRECATIONS
-
- /**
- * Creates a new instance of the specified class, but does not persist it.
- *
- * <p>
- * It is recommended that the object be initially instantiated using
- * this method, though the framework will also handle the case when
- * the object is simply <i>new()</i>ed up. The benefits of using
- * {@link #instantiate(Class)} are:
- * </p>
- *
- * <ul>
- * <li>any services will be injected into the object immediately
- * (otherwise they will not be injected until the framework
- * becomes aware of the object, typically when it is
- * {@link RepositoryService#persist(Object) persist}ed</li>
- * <li>the default value for any properties (usually as specified by
- * <tt>default<i>Xxx</i>()</tt> supporting methods) will (since 2.0) be
- * used</li>
- * <li>the <tt>created()</tt> callback will not be called.
- * </ul>
- *
- * <p>
- * The corollary is: if your code never uses <tt>default<i>Xxx</i>()</tt>
- * supporting methods or the <tt>created()</tt> callback, then you can
- * alternatively just <i>new()</i> up the object rather than call this
- * method.
- * </p>
- * @deprecated with semantic changes since 2.0 previous behavior is no longer guaranteed,
- * instead consider use of @{@link #detachedEntity(Class)} or {@link #getOrCreate(Class)}
- * if applicable
- */
- @Deprecated
- default <T> T instantiate(Class<T> domainClass) {
- return getOrCreate(domainClass);
- }
-
- // tag::refguide[]
-}
-//end::refguide[]
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/RoleMemento.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/RoleMemento.java
deleted file mode 100644
index 92882fc..0000000
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/RoleMemento.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.tooling.cli.test.doclet.samples;
-
-import java.io.Serializable;
-
-import lombok.Getter;
-import lombok.Value;
-
-/**
- * Immutable serializable value held by {@link UserMemento}.
- * @since 2.0 {@index}
- */
-@Value
-public final class RoleMemento implements Serializable {
-
- private static final long serialVersionUID = -3876856609238378274L;
-
- /**
- * Creates a new role with the specified name. Description is left blank.
- */
- public RoleMemento(final String name) {
- this(name, "");
- }
-
- /**
- * Creates a new role with the specified name and description.
- */
- public RoleMemento(final String name, final String description) {
- if (name == null) {
- throw new IllegalArgumentException("Name not specified");
- }
- this.name = name;
- if (description == null) {
- throw new IllegalArgumentException("Description not specified");
- }
- this.description = description;
- }
-
- public String title() {
- return name;
- }
-
- //@MemberOrder(sequence = "1.1")
- @Getter
- private final String name;
-
- //@MemberOrder(sequence = "1.2")
- @Getter
- private final String description;
-
-}
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/SudoService.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/SudoService.java
deleted file mode 100644
index 35acc67..0000000
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/SudoService.java
+++ /dev/null
@@ -1,29 +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.tooling.cli.test.doclet.samples;
-
-/**
- * If {@link SudoService} has been used to temporarily override the user and/or roles,
- * then the {@link UserService} will report the overridden values.
- *
- * @since 2.0 {@index}
- */
-public interface SudoService {
-
-}
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/UserMemento.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/UserMemento.java
deleted file mode 100644
index 739a433..0000000
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/UserMemento.java
+++ /dev/null
@@ -1,190 +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.tooling.cli.test.doclet.samples;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Stream;
-
-import javax.annotation.Nullable;
-
-import org.apache.isis.commons.internal.base._Strings;
-import org.apache.isis.commons.internal.collections._Lists;
-
-import lombok.Getter;
-import lombok.NonNull;
-
-/**
- * Immutable serializable value holding details about a user and its roles.
- * @since 2.0 {@index}
- */
-public final class UserMemento implements Serializable {
-
- private static final long serialVersionUID = 7190090455587885367L;
- private static final UserMemento SYSTEM_USER = UserMemento.ofName("__system");
-// private static final UserMemento NO_USER = UserMemento.ofName("__nobody");
-
- // -- FACTORIES
-
- /**
- * The framework's internal user with unrestricted privileges.
- */
- public static UserMemento system() {
- return SYSTEM_USER;
- }
-
-// /**
-// * The framework's internal user with no privileges at all, returned by the
-// * {@link UserService} if no user is logged in.
-// */
-// public static UserMemento nobody() {
-// return NO_USER;
-// }
-
- /**
- * Creates a new user with the specified name and no roles.
- */
- public static UserMemento ofName(
- final @NonNull String name) {
- return new UserMemento(name, Stream.empty());
- }
-
- /**
- * Creates a new user with the specified name and assigned roles.
- */
- public static UserMemento ofNameAndRoles(
- final @NonNull String name,
- final RoleMemento... roles) {
- return new UserMemento(name, Stream.of(roles));
- }
-
- /**
- * Creates a new user with the specified name and assigned role names.
- */
- public static UserMemento ofNameAndRoleNames(
- final @NonNull String name,
- final String... roleNames) {
- return new UserMemento(name, Stream.of(roleNames).map(RoleMemento::new));
- }
-
- /**
- * Creates a new user with the specified name and assigned role names.
- */
- public static UserMemento ofNameAndRoleNames(
- final @NonNull String name,
- final @NonNull Stream<String> roleNames) {
- return new UserMemento(name, roleNames.map(RoleMemento::new));
- }
-
- // -- CONSTRUCTOR
-
- /**
- * Creates a new user with the specified name and assigned roles.
- */
- public UserMemento(final String name, final @NonNull Stream<RoleMemento> roles) {
- if (_Strings.isEmpty(name)) {
- throw new IllegalArgumentException("Name not specified");
- }
- this.name = name;
- this.roles = roles.collect(_Lists.toUnmodifiable());
- }
-
- public String title() {
- return name;
- }
-
- /**
- * The user's login name.
- */
- //@MemberOrder(sequence = "1.1")
- @Getter
- private final String name;
-
- /**
- * The roles associated with this user.
- */
- //@MemberOrder(sequence = "1.1")
- private final List<RoleMemento> roles;
- public List<RoleMemento> getRoles() {
- return roles;
- }
-
- /**
- * Determine if the specified name is this user.
- *
- * <p>
- *
- * @return true if the names match (is case sensitive).
- */
- public boolean isCurrentUser(final @Nullable String userName) {
- return name.equals(userName);
- }
-
- public Stream<String> streamRoleNames() {
- return roles.stream()
- .map(RoleMemento::getName);
- }
-
- public boolean hasRoleName(final @Nullable String roleName) {
- return streamRoleNames().anyMatch(myRoleName->myRoleName.equals(roleName));
- }
-
- // -- TO STRING, EQUALS, HASHCODE
-
- @Override
- public String toString() {
- final StringBuilder buf = new StringBuilder();
- for (final RoleMemento role : roles) {
- buf.append(role.getName()).append(" ");
- }
- return "User [name=" + getName() + ",roles=" + buf.toString() + "]";
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (obj.getClass() != getClass()) {
- return false;
- }
- return isEqualsTo((UserMemento) obj);
- }
-
- private boolean isEqualsTo(final UserMemento other) {
- if(!Objects.equals(this.getName(), other.getName())) {
- return false;
- }
- if(!Objects.equals(this.getRoles(), other.getRoles())) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- return getName().hashCode(); // its good enough to hash on just the user's name
- }
-
-
-}
\ No newline at end of file
diff --git a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/UserService.java b/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/UserService.java
deleted file mode 100644
index 51f5ad9..0000000
--- a/tooling/cli/src/test/java/org/apache/isis/tooling/cli/test/doclet/samples/UserService.java
+++ /dev/null
@@ -1,93 +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.tooling.cli.test.doclet.samples;
-
-import java.util.Optional;
-
-import javax.annotation.Nullable;
-
-import org.apache.isis.commons.internal.exceptions._Exceptions;
-
-import lombok.NonNull;
-
-/**
- * The {@link UserService} allows the domain object to obtain the identity of the user
- * interacting with said object.
- * <p>
- * If {@link SudoService} has been used to temporarily override the user and/or roles,
- * then this service will report the overridden values instead.
- *
- * @since 2.0 {@index}
- */
-public interface UserService {
-
- // -- INTERFACE
-
- /**
- * Optionally gets the details about the current user,
- * based on whether an {@link ExecutionContext} can be found with the current thread's context.
- */
- Optional<UserMemento> currentUser();
-
- /**
- * Testimonial with arguments.
- * @param arg1 - first argument (non-null)
- * @param arg2 - second argument (non-null)
- */
- Optional<UserMemento> currentUser(@NonNull String arg1, @NonNull Optional<UserMemento> arg2);
-
- /**
- * Gets the details about the current user.
- * @apiNote for backward compatibility
- */
- @Nullable
- default UserMemento getUser() {
- return currentUser().orElse(null);
- }
-
- // -- UTILITIES
-
- /**
- * Gets the details about the current user.
- * @throws IllegalStateException if no {@link ExecutionContext} can be found with the current thread's context.
- */
- default UserMemento currentUserElseFail() {
- return currentUser()
- .orElseThrow(()->_Exceptions.illegalState("Current thread has no ExecutionContext."));
- }
-
- /**
- * Optionally gets the current user's name,
- * based on whether an {@link ExecutionContext} can be found with the current thread's context.
- */
- default Optional<String> currentUserName() {
- return currentUser()
- .map(UserMemento::getName);
- }
-
- /**
- * Gets the current user's name if available, otherwise returns {@literal Nobody}.
- * @hidden
- */
- default String currentUserNameElseNobody() {
- return currentUserName()
- .orElse("Nobody");
- }
-
-}