(obj);
+ }
+ this.associatedObject = _xifexpression;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public SarlName clone() {
+ try {
+ return (SarlName) super.clone();
+ } catch (Throwable exception) {
+ throw new Error(exception);
+ }
+ }
+
+ @SyntheticMember
+ private static final long serialVersionUID = -4780923653L;
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/ServiceName.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/ServiceName.java
new file mode 100644
index 0000000000..35eaac0bcf
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/ServiceName.java
@@ -0,0 +1,94 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.name;
+
+import com.google.common.util.concurrent.Service;
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.lang.annotation.PrivateAPI;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import org.eclipse.xtend.lib.annotations.Accessors;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * This class represents a service name.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class ServiceName extends SarlName {
+ @Accessors
+ private final Class extends Service> serviceType;
+
+ /**
+ * Constructor.
+ *
+ * @param uri the uri of the context.
+ * @param service the type of service.
+ */
+ @PrivateAPI
+ public ServiceName(final URI uri, final Class extends Service> service) {
+ super(uri);
+ this.serviceType = service;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public ServiceName clone() {
+ try {
+ return (ServiceName) super.clone();
+ } catch (Throwable exception) {
+ throw new Error(exception);
+ }
+ }
+
+ @SyntheticMember
+ private static final long serialVersionUID = -105695148L;
+
+ @Pure
+ public Class extends Service> getServiceType() {
+ return this.serviceType;
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/SkillName.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/SkillName.java
new file mode 100644
index 0000000000..1209c61f9a
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/SkillName.java
@@ -0,0 +1,143 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.name;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.lang.annotation.PrivateAPI;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import io.sarl.lang.core.Capacity;
+import java.net.URI;
+import java.util.Objects;
+import java.util.UUID;
+import org.eclipse.xtend.lib.annotations.Accessors;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * This class represents a skill name.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class SkillName extends SarlName {
+ @Accessors
+ private final UUID contextId;
+
+ @Accessors
+ private final UUID spaceId;
+
+ @Accessors
+ private final UUID agentId;
+
+ @Accessors
+ private final Class extends Capacity> capacity;
+
+ /**
+ * Constructor.
+ *
+ * @param uri the uri of the context.
+ * @param contextId the identifier of the context.
+ * @param spaceId the identifier of the space.
+ * @param agentId the identifier of the agent.
+ * @param capacity the name of the capacity implemented by the skill.
+ */
+ @PrivateAPI
+ public SkillName(final URI uri, final UUID contextId, final UUID spaceId, final UUID agentId, final Class extends Capacity> capacity) {
+ super(uri);
+ this.contextId = contextId;
+ this.spaceId = spaceId;
+ this.agentId = agentId;
+ this.capacity = capacity;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SkillName other = (SkillName) obj;
+ if (!Objects.equals(this.contextId, other.contextId))
+ return false;
+ if (!Objects.equals(this.spaceId, other.spaceId))
+ return false;
+ if (!Objects.equals(this.agentId, other.agentId))
+ return false;
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ final int prime = 31;
+ result = prime * result + Objects.hashCode(this.contextId);
+ result = prime * result + Objects.hashCode(this.spaceId);
+ result = prime * result + Objects.hashCode(this.agentId);
+ return result;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public SkillName clone() {
+ try {
+ return (SkillName) super.clone();
+ } catch (Throwable exception) {
+ throw new Error(exception);
+ }
+ }
+
+ @SyntheticMember
+ private static final long serialVersionUID = -4868198054L;
+
+ @Pure
+ public UUID getContextId() {
+ return this.contextId;
+ }
+
+ @Pure
+ public UUID getSpaceId() {
+ return this.spaceId;
+ }
+
+ @Pure
+ public UUID getAgentId() {
+ return this.agentId;
+ }
+
+ @Pure
+ public Class extends Capacity> getCapacity() {
+ return this.capacity;
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/SpaceName.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/SpaceName.java
new file mode 100644
index 0000000000..7db4c47d6e
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/name/SpaceName.java
@@ -0,0 +1,119 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.name;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.lang.annotation.PrivateAPI;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.Objects;
+import java.util.UUID;
+import org.eclipse.xtend.lib.annotations.Accessors;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * This class represents a space name.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class SpaceName extends SarlName {
+ @Accessors
+ private final UUID contextId;
+
+ @Accessors
+ private final UUID spaceId;
+
+ /**
+ * Constructor.
+ *
+ * @param uri the uri of the context.
+ * @param contextId the identifier of the context.
+ * @param spaceId the identifier of the context.
+ */
+ @PrivateAPI
+ public SpaceName(final URI uri, final UUID contextId, final UUID spaceId) {
+ super(uri);
+ this.contextId = contextId;
+ this.spaceId = spaceId;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SpaceName other = (SpaceName) obj;
+ if (!Objects.equals(this.contextId, other.contextId))
+ return false;
+ if (!Objects.equals(this.spaceId, other.spaceId))
+ return false;
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ final int prime = 31;
+ result = prime * result + Objects.hashCode(this.contextId);
+ result = prime * result + Objects.hashCode(this.spaceId);
+ return result;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public SpaceName clone() {
+ try {
+ return (SpaceName) super.clone();
+ } catch (Throwable exception) {
+ throw new Error(exception);
+ }
+ }
+
+ @SyntheticMember
+ private static final long serialVersionUID = -1080609974L;
+
+ @Pure
+ public UUID getContextId() {
+ return this.contextId;
+ }
+
+ @Pure
+ public UUID getSpaceId() {
+ return this.spaceId;
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.AbstractNamespaceService.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.AbstractNamespaceService.sarlbin
new file mode 100644
index 0000000000..f377d83470
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.AbstractNamespaceService.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.FieldAccess.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.FieldAccess.sarlbin
new file mode 100644
index 0000000000..0db04ccd04
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.FieldAccess.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.FinderBasedNamespaceService.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.FinderBasedNamespaceService.sarlbin
new file mode 100644
index 0000000000..78f4cf27eb
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.FinderBasedNamespaceService.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.INamespaceFinder.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.INamespaceFinder.sarlbin
new file mode 100644
index 0000000000..c8e8e84969
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.INamespaceFinder.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.NamespaceService.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.NamespaceService.sarlbin
new file mode 100644
index 0000000000..55545b5396
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/.NamespaceService.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/AbstractNamespaceService.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/AbstractNamespaceService.java
new file mode 100644
index 0000000000..cf93c1db7e
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/AbstractNamespaceService.java
@@ -0,0 +1,210 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.namespace;
+
+import com.google.common.base.Objects;
+import com.google.common.util.concurrent.AbstractService;
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.namespace.FieldAccess;
+import io.sarl.api.naming.namespace.NamespaceService;
+import io.sarl.api.naming.parser.INameParser;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.lang.reflect.Field;
+import javax.inject.Inject;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Abstract implementation of a service that manages name spaces into the SRE.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public abstract class AbstractNamespaceService extends AbstractService implements NamespaceService {
+ private INameParser nameParser;
+
+ @Override
+ protected final void doStart() {
+ try {
+ this.onStart();
+ this.notifyStarted();
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ final Throwable exception = (Throwable)_t;
+ this.notifyFailed(exception);
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ }
+
+ /**
+ * Do something when starting the service.
+ *
+ * This function is called from {@link #doStart()}
+ */
+ protected void onStart() {
+ }
+
+ @Override
+ protected final void doStop() {
+ try {
+ this.onStop();
+ this.notifyStopped();
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ final Throwable exception = (Throwable)_t;
+ this.notifyFailed(exception);
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ }
+
+ /**
+ * Do something when stopping the service.
+ *
+ *
This function is called from {@link #doStop()}
+ */
+ protected void onStop() {
+ }
+
+ @Pure
+ @Override
+ public INameParser getNameParser() {
+ return this.nameParser;
+ }
+
+ /**
+ * Change the name parser used by this service.
+ *
+ * @param parser the name parser, never {@code null}
+ * @since 0.11
+ */
+ @Inject
+ public void setNameParser(final INameParser parser) {
+ this.nameParser = parser;
+ }
+
+ @Override
+ @Pure
+ public final T findObject(final SarlName name, final Class type) {
+ class $AssertEvaluator$ {
+ final boolean $$result;
+ $AssertEvaluator$() {
+ this.$$result = (type != null);
+ }
+ }
+ assert new $AssertEvaluator$().$$result;
+ Object obj = this.findObject(name);
+ if (((obj != null) && type.isInstance(obj))) {
+ return type.cast(obj);
+ }
+ return null;
+ }
+
+ @Override
+ @Pure
+ public final Object findObject(final SarlName name) {
+ if ((name == null)) {
+ return null;
+ }
+ Object associatedObject = name.getAssociatedObject();
+ if ((associatedObject == null)) {
+ Object obj = this.findObjectWithoutFragment(name);
+ if (((obj != null) && name.hasFragment())) {
+ FieldAccess field = AbstractNamespaceService.getDeclaredField(obj, name);
+ if ((field != null)) {
+ associatedObject = field;
+ }
+ return field;
+ } else {
+ try {
+ associatedObject = obj;
+ } catch (final Throwable _t) {
+ if (_t instanceof ClassCastException) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ }
+ }
+ return associatedObject;
+ }
+
+ @Pure
+ private static FieldAccess getDeclaredField(final Object obj, final SarlName name) {
+ Class> type = obj.getClass();
+ while (((type != null) && (!Objects.equal(Object.class, type)))) {
+ {
+ try {
+ Field field = type.getDeclaredField(name.getFragment());
+ if ((field != null)) {
+ return new FieldAccess(name, field, obj);
+ }
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ type = type.getSuperclass();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Find an object with the given name, but ignoring the fragment.
+ *
+ * @param name the name of the object, never {@code null}.
+ * @return the object, or {@code null} if the object was not found.
+ */
+ protected abstract Object findObjectWithoutFragment(final SarlName name);
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+
+ @SyntheticMember
+ public AbstractNamespaceService() {
+ super();
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/FieldAccess.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/FieldAccess.java
new file mode 100644
index 0000000000..4c467ea9ab
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/FieldAccess.java
@@ -0,0 +1,155 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.namespace;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import org.eclipse.xtend.lib.annotations.AccessorType;
+import org.eclipse.xtend.lib.annotations.Accessors;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Accessor to a field.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class FieldAccess {
+ @Accessors(AccessorType.PUBLIC_GETTER)
+ private final SarlName name;
+
+ @Accessors(AccessorType.PUBLIC_GETTER)
+ private final Field field;
+
+ @Accessors(AccessorType.PUBLIC_GETTER)
+ private final Object instance;
+
+ /**
+ * Constructor.
+ *
+ * @param name the name of the field.
+ * @param field the field declaration.
+ * @param instance the object to have access to.
+ */
+ public FieldAccess(final SarlName name, final Field field, final Object instance) {
+ class $AssertEvaluator$ {
+ final boolean $$result;
+ $AssertEvaluator$() {
+ boolean _isStatic = Modifier.isStatic(field.getModifiers());
+ this.$$result = (!_isStatic);
+ }
+ }
+ assert new $AssertEvaluator$().$$result;
+ this.name = name;
+ this.field = field;
+ this.instance = instance;
+ this.field.setAccessible(true);
+ }
+
+ /**
+ * Replies the value of the field.
+ *
+ * @return the field's value.
+ */
+ @Pure
+ public Object get() {
+ try {
+ return this.field.get(this.instance);
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Change the value of the field.
+ *
+ * @param value the field's value.
+ * @return the value before setting.
+ * @throws IllegalArgumentException if the given value cannot be assigned to the field.
+ */
+ public Object set(final Object value) throws IllegalArgumentException {
+ try {
+ final Object oldValue = this.field.get(this.instance);
+ this.field.set(this.instance, value);
+ return oldValue;
+ } catch (final Throwable _t) {
+ if (_t instanceof IllegalArgumentException) {
+ final IllegalArgumentException ex = (IllegalArgumentException)_t;
+ throw ex;
+ } else if (_t instanceof Throwable) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ return null;
+ }
+
+ @Pure
+ @Override
+ public String toString() {
+ return this.field.getName();
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+
+ @Pure
+ public SarlName getName() {
+ return this.name;
+ }
+
+ @Pure
+ public Field getField() {
+ return this.field;
+ }
+
+ @Pure
+ public Object getInstance() {
+ return this.instance;
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/FinderBasedNamespaceService.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/FinderBasedNamespaceService.java
new file mode 100644
index 0000000000..f02bb7999c
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/FinderBasedNamespaceService.java
@@ -0,0 +1,120 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.namespace;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.namespace.AbstractNamespaceService;
+import io.sarl.api.naming.namespace.INamespaceFinder;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.util.Set;
+import java.util.TreeMap;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Implementation of a namespace service that uses the namespace finders.
+ * The finders are in charge of finding a specific type of element.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class FinderBasedNamespaceService extends AbstractNamespaceService {
+ @SuppressWarnings("raw_type")
+ private final TreeMap finders = CollectionLiterals.newTreeMap(null);
+
+ /**
+ * Change the set of namespace finders that is used by this service.
+ *
+ * This function could be overridden and annotated in subtypes in order to be used by the Guice injector.
+ *
+ * @param finders the set of finders.
+ */
+ @SuppressWarnings("raw_type")
+ public void setNamespaceFinders(final Set finders) {
+ if ((finders != null)) {
+ this.finders.clear();
+ for (final INamespaceFinder finder : finders) {
+ this.addNamespaceFinder(finder);
+ }
+ }
+ }
+
+ /**
+ * Add a namespace finder.
+ *
+ * @param finder the namespace finder to add.
+ */
+ public void addNamespaceFinder(final INamespaceFinder, ?> finder) {
+ this.finders.put(finder.getScheme(), finder);
+ }
+
+ /**
+ * Remove a namespace finder.
+ *
+ * @param scheme the scheme of the finder to remove.
+ */
+ public void removeNamespaceFinder(final NameScheme scheme) {
+ this.finders.remove(scheme);
+ }
+
+ /**
+ * Find an object by ignoring the fragment component of the given name
+ *
+ * @param name the name of the element to search for.
+ * @return the element with the given name, or {@code null} it is was not found.
+ */
+ public Object findObjectWithoutFragment(final SarlName name) {
+ final INamespaceFinder finder = this.finders.get(name.getScheme());
+ if ((finder != null)) {
+ return finder.find(name);
+ }
+ return null;
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+
+ @SyntheticMember
+ public FinderBasedNamespaceService() {
+ super();
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/INamespaceFinder.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/INamespaceFinder.java
new file mode 100644
index 0000000000..25d3cebb26
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/INamespaceFinder.java
@@ -0,0 +1,61 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.namespace;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * A tool that is able to find a specific type of object from a name into the SRE.
+ * Each type of element (agent, behavior, etc.) has a specific and dediciated implementation
+ * of finder. Of course, the finder's implementation depends strongly on the SRE implementation
+ * itself.
+ *
+ * @param the type of name that is supported by this finder.
+ * @param the type of object that is searching for.
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(11)
+@SuppressWarnings("all")
+public interface INamespaceFinder {
+ /**
+ * Replies the name scheme supported by this finder.
+ */
+ @Pure
+ NameScheme getScheme();
+
+ /**
+ * Find and replies the object with the given name.
+ *
+ * @param name the name of the object to search for.
+ * @return the object, or {@code null} if the object is not found.
+ */
+ @Pure
+ O find(final N name);
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/NamespaceService.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/NamespaceService.java
new file mode 100644
index 0000000000..9a5e138702
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/namespace/NamespaceService.java
@@ -0,0 +1,118 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.namespace;
+
+import com.google.common.util.concurrent.Service;
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.parser.INameParser;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import java.net.URI;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * This service enables to manage the name spaces into the SRE.
+ *
+ * Each object within the SRE may be identified by a name, stored into an {@link SarlName}.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(11)
+@SuppressWarnings("all")
+public interface NamespaceService extends Service {
+ /**
+ * Replies the name parser that is used by this service.
+ *
+ * @return The name parser
+ * @since 0.11
+ */
+ @Pure
+ INameParser getNameParser();
+
+ /**
+ * Finds and replies the object with the given name and of the given type.
+ *
+ * @param name the name of the object. See the documentation of {@link NamespaceService}
+ * for details.
+ * @return the root context. A {@code null} value is replied if the object is not found.
+ */
+ @Pure
+ T findObject(final SarlName name, final Class type);
+
+ /**
+ * Finds and replies the object with the given name and of the given type.
+ *
+ * @param name the name of the object. See the documentation of {@link NamespaceService}
+ * for details.
+ * @return the object with the given name. A {@code null} value is replied if the object is not found.
+ */
+ @Pure
+ Object findObject(final SarlName name);
+
+ /**
+ * Finds and replies the object with the given name and of the given type.
+ *
+ * @param name the name of the object. See the documentation of {@link NamespaceService}
+ * for details.
+ * @return the root context. A {@code null} value is replied if the object is not found.
+ * @since 0.11
+ */
+ @Pure
+ default T findObject(final String name, final Class type) {
+ INameParser parser = this.getNameParser();
+ URI nameURI = parser.decode(name);
+ if ((nameURI == null)) {
+ return null;
+ }
+ SarlName sarlName = parser.decode(nameURI);
+ if ((sarlName == null)) {
+ return null;
+ }
+ return this.findObject(sarlName, type);
+ }
+
+ /**
+ * Finds and replies the object with the given name and of the given type.
+ *
+ * @param name the name of the object. See the documentation of {@link NamespaceService}
+ * for details.
+ * @return the object with the given name. A {@code null} value is replied if the object is not found.
+ * @since 0.11
+ */
+ @Pure
+ default Object findObject(final String name) {
+ INameParser parser = this.getNameParser();
+ URI nameURI = parser.decode(name);
+ if ((nameURI == null)) {
+ return null;
+ }
+ SarlName sarlName = parser.decode(nameURI);
+ if ((sarlName == null)) {
+ return null;
+ }
+ return this.findObject(sarlName);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.AbstractSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.AbstractSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..a8d7f7efb3
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.AbstractSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.AgentSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.AgentSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..27d15a50bf
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.AgentSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.BehaviorSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.BehaviorSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..ac64096380
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.BehaviorSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ContextSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ContextSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..c8c5d678d8
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ContextSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.INameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.INameParser.sarlbin
new file mode 100644
index 0000000000..c16cbfe178
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.INameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ISchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ISchemeNameParser.sarlbin
new file mode 100644
index 0000000000..0ff08d5b3e
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ISchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ServiceSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ServiceSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..8d4192aa53
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.ServiceSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.SkillSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.SkillSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..5429d7855a
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.SkillSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.SpaceSchemeNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.SpaceSchemeNameParser.sarlbin
new file mode 100644
index 0000000000..fa9ab43dac
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.SpaceSchemeNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.UriBasedNameParser.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.UriBasedNameParser.sarlbin
new file mode 100644
index 0000000000..a1696fd4b2
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/.UriBasedNameParser.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/AbstractSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/AbstractSchemeNameParser.java
new file mode 100644
index 0000000000..49d04cae70
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/AbstractSchemeNameParser.java
@@ -0,0 +1,259 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.parser.ISchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.StringTokenizer;
+import org.eclipse.xtend.lib.annotations.Accessors;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.IntegerRange;
+import org.eclipse.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+
+/**
+ * Abstact implementation of a parser of names that is accepting URI-based syntax for a specific scheme
+ *
+ * @param the type of the name that is the result of the decoding.
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public abstract class AbstractSchemeNameParser implements ISchemeNameParser {
+ @Accessors
+ private final NameScheme scheme;
+
+ /**
+ * Constructor.
+ *
+ * @param scheme the scheme that is supported by this name parser.
+ */
+ protected AbstractSchemeNameParser(final NameScheme scheme) {
+ class $AssertEvaluator$ {
+ final boolean $$result;
+ $AssertEvaluator$() {
+ this.$$result = (scheme != null);
+ }
+ }
+ assert new $AssertEvaluator$().$$result;
+ this.scheme = scheme;
+ }
+
+ /**
+ * Refactors the URI.
+ *
+ * @param uri the URI to refactor.
+ * @param minElements is the expected minimum number of path components.
+ * @param maxElements is the expected maximum number of path components.
+ * @param lastIsInteger indicates if the last component could be an integer. In this case,
+ * the expected number of not-integer components becomes [{@code minElements}, {@code maxElements - 1}].
+ * @return the new URI.
+ */
+ @DefaultValueSource
+ protected URI refactor(final URI uri, final int minElements, final int maxElements, @DefaultValue("io.sarl.api.naming.parser.AbstractSchemeNameParser#REFACTOR_0") final boolean lastIsInteger) {
+ try {
+ final StringBuilder newPath = new StringBuilder();
+ boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(uri.getHost());
+ if ((!_isNullOrEmpty)) {
+ newPath.append("/").append(uri.getHost());
+ }
+ boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(uri.getPath());
+ if ((!_isNullOrEmpty_1)) {
+ boolean _startsWith = uri.getPath().startsWith("/");
+ if ((!_startsWith)) {
+ newPath.append("/");
+ }
+ newPath.append(uri.getPath());
+ }
+ int _length = newPath.length();
+ if ((_length == 0)) {
+ boolean _isNullOrEmpty_2 = StringExtensions.isNullOrEmpty(uri.getSchemeSpecificPart());
+ if ((!_isNullOrEmpty_2)) {
+ boolean _startsWith_1 = uri.getSchemeSpecificPart().startsWith("/");
+ if ((!_startsWith_1)) {
+ newPath.append("/");
+ }
+ newPath.append(uri.getSchemeSpecificPart());
+ }
+ }
+ final String path = newPath.toString();
+ boolean _isEmpty = path.isEmpty();
+ if ((!_isEmpty)) {
+ final String validatedPath = this.validatePath(path, minElements, maxElements, lastIsInteger);
+ boolean _isNullOrEmpty_3 = StringExtensions.isNullOrEmpty(validatedPath);
+ if ((!_isNullOrEmpty_3)) {
+ String _scheme = uri.getScheme();
+ String _string = validatedPath.toString();
+ String _fragment = uri.getFragment();
+ return new URI(_scheme, null, _string, _fragment);
+ }
+ }
+ return null;
+ } catch (Throwable _e) {
+ throw Exceptions.sneakyThrow(_e);
+ }
+ }
+
+ /**
+ * Default value for the parameter lastIsInteger
+ */
+ @SyntheticMember
+ @SarlSourceCode("false")
+ private static final boolean $DEFAULT_VALUE$REFACTOR_0 = false;
+
+ /**
+ * Validate the path.
+ *
+ * @param path the path to validate.
+ * @param minElements is the expected minimum number of path components.
+ * @param maxElements is the expected maximum number of path components.
+ * @param lastIsInteger indicates if the last component could be an integer. In this case,
+ * the expected number of not-integer components becomes [{@code minElements}, {@code maxElements - 1}].
+ * @return the validated path.
+ */
+ @DefaultValueSource
+ protected String validatePath(final String path, final int minElements, final int maxElements, @DefaultValue("io.sarl.api.naming.parser.AbstractSchemeNameParser#VALIDATEPATH_0") final boolean lastIsInteger) {
+ boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(path);
+ if (_isNullOrEmpty) {
+ String _xifexpression = null;
+ boolean _contains = new IntegerRange(minElements, maxElements).contains(0);
+ if (_contains) {
+ _xifexpression = "";
+ } else {
+ _xifexpression = null;
+ }
+ return _xifexpression;
+ }
+ StringTokenizer tokenizer = new StringTokenizer(path, "/");
+ StringBuilder buffer = new StringBuilder();
+ String lastComponent = null;
+ int nb = 0;
+ while (tokenizer.hasMoreTokens()) {
+ {
+ String token = tokenizer.nextToken();
+ boolean _isNullOrEmpty_1 = StringExtensions.isNullOrEmpty(token);
+ if (_isNullOrEmpty_1) {
+ return null;
+ }
+ buffer.append("/").append(token);
+ lastComponent = token;
+ nb++;
+ }
+ }
+ if (lastIsInteger) {
+ try {
+ Integer.parseUnsignedInt(lastComponent, 10);
+ boolean _contains_1 = new IntegerRange((minElements + 1), maxElements).contains(nb);
+ if (_contains_1) {
+ return buffer.toString();
+ }
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ boolean _contains_2 = new IntegerRange(minElements, (maxElements - 1)).contains(nb);
+ if (_contains_2) {
+ return buffer.toString();
+ }
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ } else {
+ boolean _contains_1 = new IntegerRange(minElements, maxElements).contains(nb);
+ if (_contains_1) {
+ return buffer.toString();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Default value for the parameter lastIsInteger
+ */
+ @SyntheticMember
+ @SarlSourceCode("false")
+ private static final boolean $DEFAULT_VALUE$VALIDATEPATH_0 = false;
+
+ /**
+ * Refactors the URI.
+ *
+ * @param uri the URI to refactor.
+ * @param minElements is the expected minimum number of path components.
+ * @param maxElements is the expected maximum number of path components.
+ * @optionalparam lastIsInteger indicates if the last component could be an integer. In this case,
+ * the expected number of not-integer components becomes [{@code minElements}, {@code maxElements - 1}].
+ * @return the new URI.
+ */
+ @DefaultValueUse("java.net.URI,int,int,boolean")
+ @SyntheticMember
+ protected final URI refactor(final URI uri, final int minElements, final int maxElements) {
+ return refactor(uri, minElements, maxElements, $DEFAULT_VALUE$REFACTOR_0);
+ }
+
+ /**
+ * Validate the path.
+ *
+ * @param path the path to validate.
+ * @param minElements is the expected minimum number of path components.
+ * @param maxElements is the expected maximum number of path components.
+ * @optionalparam lastIsInteger indicates if the last component could be an integer. In this case,
+ * the expected number of not-integer components becomes [{@code minElements}, {@code maxElements - 1}].
+ * @return the validated path.
+ */
+ @DefaultValueUse("java.lang.String,int,int,boolean")
+ @SyntheticMember
+ protected final String validatePath(final String path, final int minElements, final int maxElements) {
+ return validatePath(path, minElements, maxElements, $DEFAULT_VALUE$VALIDATEPATH_0);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+
+ @Pure
+ public NameScheme getScheme() {
+ return this.scheme;
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/AgentSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/AgentSchemeNameParser.java
new file mode 100644
index 0000000000..387a399378
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/AgentSchemeNameParser.java
@@ -0,0 +1,119 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.AgentName;
+import io.sarl.api.naming.parser.AbstractSchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.StringTokenizer;
+import java.util.UUID;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Parser of agent names that is accepting URI-based syntax.
+ *
+ * The different types of names are:
+ * {@code "agent:[/]{0-2}agentId[#fragmentName]"}
+ * {@code "agent:[/]{0-2}contextId/agentId[#fragmentName]"}
+ * {@code "agent:[/]{0-2}contextId/spaceId/agentId[#fragmentName]"}
+ *
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class AgentSchemeNameParser extends AbstractSchemeNameParser {
+ /**
+ * Constructor.
+ *
+ * @param scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.AGENT}.
+ */
+ @DefaultValueSource
+ public AgentSchemeNameParser(@DefaultValue("io.sarl.api.naming.parser.AgentSchemeNameParser#NEW_0") final NameScheme scheme) {
+ super(scheme);
+ }
+
+ /**
+ * Default value for the parameter scheme
+ */
+ @SyntheticMember
+ @SarlSourceCode("NameScheme::AGENT")
+ private static final NameScheme $DEFAULT_VALUE$NEW_0 = NameScheme.AGENT;
+
+ @Pure
+ @Override
+ public URI refactor(final URI name) {
+ return this.refactor(name, 1, 3);
+ }
+
+ @Pure
+ @Override
+ public AgentName decode(final URI name) {
+ String _path = name.getPath();
+ final StringTokenizer tokenizer = new StringTokenizer(_path, "/");
+ boolean _hasMoreTokens = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens) {
+ final String token0 = tokenizer.nextToken();
+ boolean _hasMoreTokens_1 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_1) {
+ final String token1 = tokenizer.nextToken();
+ boolean _hasMoreTokens_2 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_2) {
+ final String token2 = tokenizer.nextToken();
+ UUID _fromString = UUID.fromString(token0);
+ UUID _fromString_1 = UUID.fromString(token1);
+ UUID _fromString_2 = UUID.fromString(token2);
+ return new AgentName(name, _fromString, _fromString_1, _fromString_2);
+ }
+ UUID _fromString_3 = UUID.fromString(token0);
+ UUID _fromString_4 = UUID.fromString(token1);
+ return new AgentName(name, _fromString_3, null, _fromString_4);
+ }
+ UUID _fromString_5 = UUID.fromString(token0);
+ return new AgentName(name, null, null, _fromString_5);
+ }
+ return null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @optionalparam scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.AGENT}.
+ */
+ @DefaultValueUse("io.sarl.api.naming.scheme.NameScheme")
+ @SyntheticMember
+ public AgentSchemeNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/BehaviorSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/BehaviorSchemeNameParser.java
new file mode 100644
index 0000000000..b3d3b5c487
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/BehaviorSchemeNameParser.java
@@ -0,0 +1,172 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.BehaviorName;
+import io.sarl.api.naming.parser.AbstractSchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.bootstrap.SREClassLoader;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import io.sarl.lang.core.Behavior;
+import java.net.URI;
+import java.util.StringTokenizer;
+import java.util.UUID;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Parser of behavior names that is accepting URI-based syntax.
+ *
+ * The different types of names are:
+ * {@code "behavior:[/]{0-2}agentId/behaviorName[/behaviorIndex][#fragmentName]"}
+ * {@code "behavior:[/]{0-2}contextId/agentId/behaviorName[/behaviorIndex][#fragmentName]"}
+ * {@code "behavior:[/]{0-2}contextId/spaceId/agentId/behaviorName[/behaviorIndex][#fragmentName]"}
+ *
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class BehaviorSchemeNameParser extends AbstractSchemeNameParser {
+ /**
+ * Constructor.
+ *
+ * @param scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.BEHAVIOR}.
+ */
+ @DefaultValueSource
+ public BehaviorSchemeNameParser(@DefaultValue("io.sarl.api.naming.parser.BehaviorSchemeNameParser#NEW_0") final NameScheme scheme) {
+ super(scheme);
+ }
+
+ /**
+ * Default value for the parameter scheme
+ */
+ @SyntheticMember
+ @SarlSourceCode("NameScheme::BEHAVIOR")
+ private static final NameScheme $DEFAULT_VALUE$NEW_0 = NameScheme.BEHAVIOR;
+
+ @Pure
+ @Override
+ public URI refactor(final URI name) {
+ return this.refactor(name, 2, 5, true);
+ }
+
+ @Pure
+ @Override
+ public BehaviorName decode(final URI name) {
+ try {
+ String _path = name.getPath();
+ final StringTokenizer tokenizer = new StringTokenizer(_path, "/");
+ boolean _hasMoreTokens = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens) {
+ final String token0 = tokenizer.nextToken();
+ boolean _hasMoreTokens_1 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_1) {
+ final String token1 = tokenizer.nextToken();
+ boolean _hasMoreTokens_2 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_2) {
+ final String token2 = tokenizer.nextToken();
+ boolean _hasMoreTokens_3 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_3) {
+ final String token3 = tokenizer.nextToken();
+ boolean _hasMoreTokens_4 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_4) {
+ final String token4 = tokenizer.nextToken();
+ UUID _fromString = UUID.fromString(token0);
+ UUID _fromString_1 = UUID.fromString(token1);
+ UUID _fromString_2 = UUID.fromString(token2);
+ Class> _loadClass = SREClassLoader.loadClass(token3, true, this.getClass().getClassLoader());
+ int _parseUnsignedInt = Integer.parseUnsignedInt(token4, 10);
+ return new BehaviorName(name, _fromString, _fromString_1, _fromString_2,
+ ((Class extends Behavior>) _loadClass), _parseUnsignedInt);
+ }
+ try {
+ Class> _forName = Class.forName(token2);
+ Class extends Behavior> beh = ((Class extends Behavior>) _forName);
+ UUID _fromString_3 = UUID.fromString(token0);
+ UUID _fromString_4 = UUID.fromString(token1);
+ int _parseUnsignedInt_1 = Integer.parseUnsignedInt(token3, 10);
+ return new BehaviorName(name, _fromString_3, null, _fromString_4, beh, _parseUnsignedInt_1);
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ UUID _fromString_5 = UUID.fromString(token0);
+ UUID _fromString_6 = UUID.fromString(token1);
+ UUID _fromString_7 = UUID.fromString(token2);
+ Class> _forName_1 = Class.forName(token3);
+ return new BehaviorName(name, _fromString_5, _fromString_6, _fromString_7, ((Class extends Behavior>) _forName_1),
+ (-1));
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ }
+ try {
+ Class> _forName = Class.forName(token1);
+ Class extends Behavior> beh = ((Class extends Behavior>) _forName);
+ UUID _fromString_3 = UUID.fromString(token0);
+ int _parseUnsignedInt_1 = Integer.parseUnsignedInt(token2, 10);
+ return new BehaviorName(name, null, null, _fromString_3, beh, _parseUnsignedInt_1);
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ UUID _fromString_4 = UUID.fromString(token0);
+ UUID _fromString_5 = UUID.fromString(token1);
+ Class> _forName_1 = Class.forName(token2);
+ return new BehaviorName(name, _fromString_4, null, _fromString_5, ((Class extends Behavior>) _forName_1),
+ (-1));
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ }
+ UUID _fromString_3 = UUID.fromString(token0);
+ Class> _forName = Class.forName(token1);
+ return new BehaviorName(name, null, null, _fromString_3,
+ ((Class extends Behavior>) _forName), (-1));
+ }
+ }
+ return null;
+ } catch (Throwable _e) {
+ throw Exceptions.sneakyThrow(_e);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @optionalparam scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.BEHAVIOR}.
+ */
+ @DefaultValueUse("io.sarl.api.naming.scheme.NameScheme")
+ @SyntheticMember
+ public BehaviorSchemeNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ContextSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ContextSchemeNameParser.java
new file mode 100644
index 0000000000..503ad7b723
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ContextSchemeNameParser.java
@@ -0,0 +1,102 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.ContextName;
+import io.sarl.api.naming.parser.AbstractSchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.StringTokenizer;
+import java.util.UUID;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Parser of context names that is accepting URI-based syntax.
+ *
+ * The different types of names are:
+ * {@code "context:[/]{0-2}contextId[#fragmentName]"}
+ *
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class ContextSchemeNameParser extends AbstractSchemeNameParser {
+ /**
+ * Constructor.
+ *
+ * @param scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.CONTEXT}.
+ */
+ @DefaultValueSource
+ public ContextSchemeNameParser(@DefaultValue("io.sarl.api.naming.parser.ContextSchemeNameParser#NEW_0") final NameScheme scheme) {
+ super(scheme);
+ }
+
+ /**
+ * Default value for the parameter scheme
+ */
+ @SyntheticMember
+ @SarlSourceCode("NameScheme::CONTEXT")
+ private static final NameScheme $DEFAULT_VALUE$NEW_0 = NameScheme.CONTEXT;
+
+ @Pure
+ @Override
+ public URI refactor(final URI name) {
+ return this.refactor(name, 1, 1);
+ }
+
+ @Pure
+ @Override
+ public ContextName decode(final URI name) {
+ String _path = name.getPath();
+ final StringTokenizer tokenizer = new StringTokenizer(_path, "/");
+ boolean _hasMoreTokens = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens) {
+ final String token = tokenizer.nextToken();
+ UUID _fromString = UUID.fromString(token);
+ return new ContextName(name, _fromString);
+ }
+ return null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @optionalparam scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.CONTEXT}.
+ */
+ @DefaultValueUse("io.sarl.api.naming.scheme.NameScheme")
+ @SyntheticMember
+ public ContextSchemeNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/INameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/INameParser.java
new file mode 100644
index 0000000000..dfc7ad3883
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/INameParser.java
@@ -0,0 +1,102 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.parser.ISchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import java.net.URI;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+
+/**
+ * Parser of names
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(11)
+@SuppressWarnings("all")
+public interface INameParser {
+ /**
+ * Parse the string representation of the name, and create the URI representation.
+ *
+ * @param name the string representation of the name.
+ * @return the URI representation of the given name, or {@code null} if the given string cannot be parsed.
+ */
+ @Pure
+ default URI decode(final String name) {
+ boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(name);
+ if ((!_isNullOrEmpty)) {
+ try {
+ URI uri = URI.create(name);
+ return this.normalize(uri);
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Parse the string representation of the name, and create the URI representation.
+ *
+ * @param name the string representation of the name.
+ * @return the URI representation of the given name, or {@code null} if the given string cannot be parsed.
+ */
+ @Pure
+ URI normalize(final URI name);
+
+ /**
+ * Parse the URI of the name, and create the name object.
+ * The argument must be a normalized URI that is computed by {@link #normalize(URI)}.
+ *
+ * @param name the normalized URI representation of the name. See {@link #normalize(URI)}.
+ * @return the name, or {@code null} if the given URI cannot be parsed.
+ */
+ @Pure
+ SarlName decode(final URI name);
+
+ /**
+ * Register a name parser for a specific scheme.
+ *
+ * @param parser the name parser, never {@code null}.
+ */
+ void addSchemeNameParser(final ISchemeNameParser> parser);
+
+ /**
+ * Unregister a name parser for a specific scheme.
+ *
+ * @param scheme the associated scheme, never {@code null}.
+ * @return the name parser that was associated to the name protocol.
+ */
+ ISchemeNameParser> removeSchemeNameParser(final NameScheme scheme);
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ISchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ISchemeNameParser.java
new file mode 100644
index 0000000000..915f71c87e
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ISchemeNameParser.java
@@ -0,0 +1,61 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import java.net.URI;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * A parser of names that is accepting URI-based syntax for a specific scheme.
+ *
+ * @param the type of the name that is the result of the decoding.
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(11)
+@SuppressWarnings("all")
+public interface ISchemeNameParser {
+ /**
+ * Replies the name scheme that is supported by this parser.
+ */
+ @Pure
+ NameScheme getScheme();
+
+ /**
+ * Refactor the given URI in order to fit the name specification.
+ */
+ @Pure
+ URI refactor(final URI name);
+
+ /**
+ * Decode the name.
+ */
+ @Pure
+ N decode(final URI name);
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ServiceSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ServiceSchemeNameParser.java
new file mode 100644
index 0000000000..1d38555019
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/ServiceSchemeNameParser.java
@@ -0,0 +1,108 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import com.google.common.util.concurrent.Service;
+import io.sarl.api.naming.name.ServiceName;
+import io.sarl.api.naming.parser.AbstractSchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.bootstrap.SREClassLoader;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.StringTokenizer;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Parser of service names that is accepting URI-based syntax.
+ *
+ * The different types of names are:
+ * {@code "service:[/]{0-2}serviceName][#fragmentName]"}
+ *
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class ServiceSchemeNameParser extends AbstractSchemeNameParser {
+ /**
+ * Constructor.
+ *
+ * @param scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.SERVICE}.
+ */
+ @DefaultValueSource
+ public ServiceSchemeNameParser(@DefaultValue("io.sarl.api.naming.parser.ServiceSchemeNameParser#NEW_0") final NameScheme scheme) {
+ super(scheme);
+ }
+
+ /**
+ * Default value for the parameter scheme
+ */
+ @SyntheticMember
+ @SarlSourceCode("NameScheme::SERVICE")
+ private static final NameScheme $DEFAULT_VALUE$NEW_0 = NameScheme.SERVICE;
+
+ @Pure
+ @Override
+ public URI refactor(final URI name) {
+ return this.refactor(name, 1, 1);
+ }
+
+ @Pure
+ @Override
+ public ServiceName decode(final URI name) {
+ try {
+ String _path = name.getPath();
+ final StringTokenizer tokenizer = new StringTokenizer(_path, "/");
+ boolean _hasMoreTokens = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens) {
+ final String token = tokenizer.nextToken();
+ Class> _loadClass = SREClassLoader.loadClass(token, true, this.getClass().getClassLoader());
+ return new ServiceName(name, ((Class extends Service>) _loadClass));
+ }
+ return null;
+ } catch (Throwable _e) {
+ throw Exceptions.sneakyThrow(_e);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @optionalparam scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.SERVICE}.
+ */
+ @DefaultValueUse("io.sarl.api.naming.scheme.NameScheme")
+ @SyntheticMember
+ public ServiceSchemeNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/SkillSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/SkillSchemeNameParser.java
new file mode 100644
index 0000000000..59d7d36201
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/SkillSchemeNameParser.java
@@ -0,0 +1,135 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.SkillName;
+import io.sarl.api.naming.parser.AbstractSchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.bootstrap.SREClassLoader;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import io.sarl.lang.core.Capacity;
+import java.net.URI;
+import java.util.StringTokenizer;
+import java.util.UUID;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Parser of skill names that is accepting URI-based syntax.
+ *
+ * The different types of names are:
+ * {@code "skill:[/]{0-2}agentId/capacityName[#fragmentName]"}
+ * {@code "skill:[/]{0-2}contextId/agentId/capacityName[#fragmentName]"}
+ * {@code "skill:[/]{0-2}contextId/spaceId/agentId/capacityName[#fragmentName]"}
+ *
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class SkillSchemeNameParser extends AbstractSchemeNameParser {
+ /**
+ * Constructor.
+ *
+ * @param scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.SKILL}.
+ */
+ @DefaultValueSource
+ public SkillSchemeNameParser(@DefaultValue("io.sarl.api.naming.parser.SkillSchemeNameParser#NEW_0") final NameScheme scheme) {
+ super(scheme);
+ }
+
+ /**
+ * Default value for the parameter scheme
+ */
+ @SyntheticMember
+ @SarlSourceCode("NameScheme::SKILL")
+ private static final NameScheme $DEFAULT_VALUE$NEW_0 = NameScheme.SKILL;
+
+ @Pure
+ @Override
+ public URI refactor(final URI name) {
+ return this.refactor(name, 2, 4);
+ }
+
+ @Pure
+ @Override
+ public SkillName decode(final URI name) {
+ try {
+ String _path = name.getPath();
+ final StringTokenizer tokenizer = new StringTokenizer(_path, "/");
+ boolean _hasMoreTokens = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens) {
+ final String token0 = tokenizer.nextToken();
+ boolean _hasMoreTokens_1 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_1) {
+ final String token1 = tokenizer.nextToken();
+ boolean _hasMoreTokens_2 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_2) {
+ final String token2 = tokenizer.nextToken();
+ boolean _hasMoreTokens_3 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_3) {
+ final String token3 = tokenizer.nextToken();
+ UUID _fromString = UUID.fromString(token0);
+ UUID _fromString_1 = UUID.fromString(token1);
+ UUID _fromString_2 = UUID.fromString(token2);
+ Class> _loadClass = SREClassLoader.loadClass(token3, true, this.getClass().getClassLoader());
+ return new SkillName(name, _fromString, _fromString_1, _fromString_2, ((Class extends Capacity>) _loadClass));
+ }
+ UUID _fromString_3 = UUID.fromString(token0);
+ UUID _fromString_4 = UUID.fromString(token1);
+ Class> _forName = Class.forName(token2);
+ return new SkillName(name, _fromString_3, null, _fromString_4,
+ ((Class extends Capacity>) _forName));
+ }
+ UUID _fromString_5 = UUID.fromString(token0);
+ Class> _forName_1 = Class.forName(token1);
+ return new SkillName(name, null, null, _fromString_5,
+ ((Class extends Capacity>) _forName_1));
+ }
+ }
+ return null;
+ } catch (Throwable _e) {
+ throw Exceptions.sneakyThrow(_e);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @optionalparam scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.SKILL}.
+ */
+ @DefaultValueUse("io.sarl.api.naming.scheme.NameScheme")
+ @SyntheticMember
+ public SkillSchemeNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/SpaceSchemeNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/SpaceSchemeNameParser.java
new file mode 100644
index 0000000000..52688cf61a
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/SpaceSchemeNameParser.java
@@ -0,0 +1,107 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.SpaceName;
+import io.sarl.api.naming.parser.AbstractSchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.StringTokenizer;
+import java.util.UUID;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Parser of space names that is accepting URI-based syntax.
+ *
+ * The different types of names are:
+ * {@code "space:[/]{0-2}contextId/spaceId[#fragmentName]"}
+ *
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class SpaceSchemeNameParser extends AbstractSchemeNameParser {
+ /**
+ * Constructor.
+ *
+ * @param scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.SPACE}.
+ */
+ @DefaultValueSource
+ public SpaceSchemeNameParser(@DefaultValue("io.sarl.api.naming.parser.SpaceSchemeNameParser#NEW_0") final NameScheme scheme) {
+ super(scheme);
+ }
+
+ /**
+ * Default value for the parameter scheme
+ */
+ @SyntheticMember
+ @SarlSourceCode("NameScheme::SPACE")
+ private static final NameScheme $DEFAULT_VALUE$NEW_0 = NameScheme.SPACE;
+
+ @Pure
+ @Override
+ public URI refactor(final URI name) {
+ return this.refactor(name, 2, 2);
+ }
+
+ @Pure
+ @Override
+ public SpaceName decode(final URI name) {
+ String _path = name.getPath();
+ final StringTokenizer tokenizer = new StringTokenizer(_path, "/");
+ boolean _hasMoreTokens = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens) {
+ final String token0 = tokenizer.nextToken();
+ boolean _hasMoreTokens_1 = tokenizer.hasMoreTokens();
+ if (_hasMoreTokens_1) {
+ final String token1 = tokenizer.nextToken();
+ UUID _fromString = UUID.fromString(token0);
+ UUID _fromString_1 = UUID.fromString(token1);
+ return new SpaceName(name, _fromString, _fromString_1);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @optionalparam scheme the name scheme that is supported by this parser. By default it is {@link NameScheme.SPACE}.
+ */
+ @DefaultValueUse("io.sarl.api.naming.scheme.NameScheme")
+ @SyntheticMember
+ public SpaceSchemeNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/UriBasedNameParser.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/UriBasedNameParser.java
new file mode 100644
index 0000000000..acd768c337
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/parser/UriBasedNameParser.java
@@ -0,0 +1,190 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.parser;
+
+import io.sarl.api.naming.name.SarlName;
+import io.sarl.api.naming.parser.INameParser;
+import io.sarl.api.naming.parser.ISchemeNameParser;
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.api.naming.scheme.NameSchemes;
+import io.sarl.lang.annotation.DefaultValue;
+import io.sarl.lang.annotation.DefaultValueSource;
+import io.sarl.lang.annotation.DefaultValueUse;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSourceCode;
+import io.sarl.lang.annotation.SarlSpecification;
+import io.sarl.lang.annotation.SyntheticMember;
+import java.net.URI;
+import java.util.Set;
+import java.util.TreeMap;
+import org.eclipse.xtext.xbase.lib.CollectionLiterals;
+import org.eclipse.xtext.xbase.lib.Exceptions;
+import org.eclipse.xtext.xbase.lib.Pure;
+import org.eclipse.xtext.xbase.lib.StringExtensions;
+
+/**
+ * Default implementation of a parser of names that is accepting URI-based syntax.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public class UriBasedNameParser implements INameParser {
+ private final TreeMap> schemeNameParser = CollectionLiterals.>newTreeMap(null);
+
+ /**
+ * Construct a name parser based on the given scheme parsers.
+ *
+ * @param parsers the set of scheme name parsers.
+ */
+ @DefaultValueSource
+ @SuppressWarnings("raw_type")
+ public UriBasedNameParser(@DefaultValue("io.sarl.api.naming.parser.UriBasedNameParser#NEW_0") final Set parsers) {
+ if (((parsers != null) && (!parsers.isEmpty()))) {
+ this.setSchemeNameParsers(parsers);
+ }
+ }
+
+ /**
+ * Default value for the parameter parsers
+ */
+ @SyntheticMember
+ @SarlSourceCode("null")
+ private static final Set $DEFAULT_VALUE$NEW_0 = null;
+
+ /**
+ * Change the set of scheme name parsers that is used by this base name parser.
+ *
+ * This function could be overridden and annotated in subtypes in order to be used by the Guice injector.
+ *
+ * @param parsers the set of scheme name parsers.
+ */
+ @SuppressWarnings("raw_type")
+ public void setSchemeNameParsers(final Set parsers) {
+ if ((parsers != null)) {
+ this.schemeNameParser.clear();
+ for (final ISchemeNameParser parser : parsers) {
+ this.addSchemeNameParser(parser);
+ }
+ }
+ }
+
+ @Override
+ public void addSchemeNameParser(final ISchemeNameParser> parser) {
+ class $AssertEvaluator$ {
+ final boolean $$result;
+ $AssertEvaluator$() {
+ this.$$result = (parser != null);
+ }
+ }
+ assert new $AssertEvaluator$().$$result;
+ this.schemeNameParser.put(parser.getScheme(), parser);
+ }
+
+ @Override
+ public ISchemeNameParser> removeSchemeNameParser(final NameScheme scheme) {
+ ISchemeNameParser> _xblockexpression = null;
+ {
+ class $AssertEvaluator$ {
+ final boolean $$result;
+ $AssertEvaluator$() {
+ this.$$result = (scheme != null);
+ }
+ }
+ assert new $AssertEvaluator$().$$result;
+ _xblockexpression = this.schemeNameParser.remove(scheme);
+ }
+ return _xblockexpression;
+ }
+
+ @Pure
+ public URI normalize(final URI name) {
+ try {
+ final String scheme = name.getScheme();
+ final NameScheme schemeObj = NameSchemes.getSchemeObject(scheme);
+ if (((((schemeObj != null) && StringExtensions.isNullOrEmpty(name.getQuery())) && StringExtensions.isNullOrEmpty(name.getUserInfo())) && (name.getPort() == (-1)))) {
+ ISchemeNameParser> parser = this.schemeNameParser.get(schemeObj);
+ if ((parser != null)) {
+ return parser.refactor(name);
+ }
+ }
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ return null;
+ }
+
+ @Pure
+ @Override
+ public SarlName decode(final URI name) {
+ try {
+ if ((((name != null) && (name.getPath() != null)) && name.getPath().startsWith("/"))) {
+ NameScheme scheme = NameSchemes.getSchemeObject(name.getScheme());
+ if ((scheme != null)) {
+ ISchemeNameParser> parser = this.schemeNameParser.get(scheme);
+ if ((parser != null)) {
+ return parser.decode(name);
+ }
+ }
+ }
+ } catch (final Throwable _t) {
+ if (_t instanceof Throwable) {
+ } else {
+ throw Exceptions.sneakyThrow(_t);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Construct a name parser based on the given scheme parsers.
+ *
+ * @optionalparam parsers the set of scheme name parsers.
+ */
+ @DefaultValueUse("java.util.Set")
+ @SyntheticMember
+ public UriBasedNameParser() {
+ this($DEFAULT_VALUE$NEW_0);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public boolean equals(final Object obj) {
+ return super.equals(obj);
+ }
+
+ @Override
+ @Pure
+ @SyntheticMember
+ public int hashCode() {
+ int result = super.hashCode();
+ return result;
+ }
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/.NameScheme.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/.NameScheme.sarlbin
new file mode 100644
index 0000000000..a748219c18
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/.NameScheme.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/.NameSchemes.sarlbin b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/.NameSchemes.sarlbin
new file mode 100644
index 0000000000..711810ed2d
Binary files /dev/null and b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/.NameSchemes.sarlbin differ
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/NameScheme.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/NameScheme.java
new file mode 100644
index 0000000000..c05c66698c
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/NameScheme.java
@@ -0,0 +1,50 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.scheme;
+
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+
+/**
+ * Name of a scheme that is supported for names' specification.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(12)
+@SuppressWarnings("all")
+public enum NameScheme {
+ CONTEXT,
+
+ SPACE,
+
+ AGENT,
+
+ SKILL,
+
+ BEHAVIOR,
+
+ SERVICE;
+}
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/NameSchemes.java b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/NameSchemes.java
new file mode 100644
index 0000000000..02d21fd000
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/generated-sources/sarl/io/sarl/api/naming/scheme/NameSchemes.java
@@ -0,0 +1,60 @@
+/**
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.scheme;
+
+import io.sarl.api.naming.scheme.NameScheme;
+import io.sarl.lang.annotation.SarlElementType;
+import io.sarl.lang.annotation.SarlSpecification;
+import org.eclipse.xtext.xbase.lib.Pure;
+
+/**
+ * Utilities for name schemes.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+@SarlSpecification("0.12")
+@SarlElementType(10)
+@SuppressWarnings("all")
+public final class NameSchemes {
+ private NameSchemes() {
+ }
+
+ /**
+ * Parse the scheme for a named object.
+ */
+ @Pure
+ public static NameScheme getSchemeObject(final String scheme) {
+ if ((scheme != null)) {
+ NameScheme[] _values = NameScheme.values();
+ for (final NameScheme s : _values) {
+ boolean _equalsIgnoreCase = scheme.equalsIgnoreCase(s.name());
+ if (_equalsIgnoreCase) {
+ return s;
+ }
+ }
+ }
+ return null;
+ }
+}
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AgentName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/AgentName.sarl
similarity index 89%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AgentName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/AgentName.sarl
index 36bdf96884..cd417d74b3 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AgentName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/AgentName.sarl
@@ -18,11 +18,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
import java.net.URI
import java.util.UUID
import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.lang.annotation.PrivateAPI
/**
* This class represents a space name.
@@ -31,7 +32,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class AgentName extends SarlName {
@@ -51,7 +52,8 @@ class AgentName extends SarlName {
* @param spaceId the identifier of the space.
* @param agentId the identifier of the agent.
*/
- protected new (uri : URI, contextId : UUID, spaceId : UUID, agentId : UUID) {
+ @PrivateAPI
+ new (uri : URI, contextId : UUID, spaceId : UUID, agentId : UUID) {
super(uri)
this.contextId = contextId
this.spaceId = spaceId
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/BehaviorName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/BehaviorName.sarl
similarity index 91%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/BehaviorName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/BehaviorName.sarl
index e8fa8face8..3b3018a0c4 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/BehaviorName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/BehaviorName.sarl
@@ -18,12 +18,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
import io.sarl.lang.core.Behavior
import java.net.URI
import java.util.UUID
import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.lang.annotation.PrivateAPI
/**
* This class represents a behavior name.
@@ -32,7 +33,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class BehaviorName extends SarlName {
@@ -60,7 +61,8 @@ class BehaviorName extends SarlName {
* @param behaviorType the type of the behavior.
* @param behaviorIndex the index of the behavior in the list of behaviors.
*/
- protected new (uri : URI, contextId : UUID, spaceId : UUID, agentId : UUID,
+ @PrivateAPI
+ new (uri : URI, contextId : UUID, spaceId : UUID, agentId : UUID,
behaviorType : Class extends Behavior>, behaviorIndex : int) {
super(uri)
this.contextId = contextId
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ContextName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/ContextName.sarl
similarity index 89%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ContextName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/ContextName.sarl
index a452a388c9..08cf952ae6 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ContextName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/ContextName.sarl
@@ -18,11 +18,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
import java.net.URI
import java.util.UUID
import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.lang.annotation.PrivateAPI
/**
* This class represents a context name.
@@ -31,7 +32,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class ContextName extends SarlName {
@@ -43,7 +44,8 @@ class ContextName extends SarlName {
* @param uri the uri of the context.
* @param contextId the identifier of the context.
*/
- protected new (uri : URI, contextId : UUID) {
+ @PrivateAPI
+ new (uri : URI, contextId : UUID) {
super(uri)
this.contextId = contextId
}
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SarlName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SarlName.sarl
similarity index 92%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SarlName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SarlName.sarl
index 8207bdb2ee..78d0ecac2d 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SarlName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SarlName.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
+import io.sarl.api.naming.scheme.NameScheme
+import io.sarl.api.naming.scheme.NameSchemes
import java.io.Serializable
import java.lang.ref.WeakReference
import java.net.URI
@@ -40,7 +42,7 @@ import java.net.URI
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
abstract class SarlName implements Cloneable, Serializable, Comparable {
@@ -63,7 +65,7 @@ abstract class SarlName implements Cloneable, Serializable, Comparable
*/
def getScheme : NameScheme {
if (this.scheme === null) {
- this.scheme = INameParser::getSchemeObject(toURI.scheme)
+ this.scheme = NameSchemes::getSchemeObject(toURI.scheme)
}
return this.scheme
}
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ServiceName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/ServiceName.sarl
similarity index 89%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ServiceName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/ServiceName.sarl
index f5c6d3bb5f..1af22871ca 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ServiceName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/ServiceName.sarl
@@ -18,11 +18,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
import com.google.common.util.concurrent.Service
import java.net.URI
import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.lang.annotation.PrivateAPI
/**
* This class represents a service name.
@@ -31,7 +32,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class ServiceName extends SarlName {
@@ -43,7 +44,8 @@ class ServiceName extends SarlName {
* @param uri the uri of the context.
* @param service the type of service.
*/
- protected new (uri : URI, service : Class extends Service>) {
+ @PrivateAPI
+ new (uri : URI, service : Class extends Service>) {
super(uri)
this.serviceType = service
}
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SkillName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SkillName.sarl
similarity index 88%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SkillName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SkillName.sarl
index 2faa0173ed..520df6c2f2 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SkillName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SkillName.sarl
@@ -18,12 +18,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
import io.sarl.lang.core.Capacity
import java.net.URI
import java.util.UUID
import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.lang.annotation.PrivateAPI
/**
* This class represents a skill name.
@@ -32,7 +33,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class SkillName extends SarlName {
@@ -56,7 +57,8 @@ class SkillName extends SarlName {
* @param agentId the identifier of the agent.
* @param capacity the name of the capacity implemented by the skill.
*/
- protected new (uri : URI, contextId : UUID, spaceId : UUID, agentId : UUID, ^capacity : Class extends Capacity>) {
+ @PrivateAPI
+ new (uri : URI, contextId : UUID, spaceId : UUID, agentId : UUID, ^capacity : Class extends Capacity>) {
super(uri)
this.contextId = contextId
this.spaceId = spaceId
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SpaceName.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SpaceName.sarl
similarity index 89%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SpaceName.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SpaceName.sarl
index a75ffbb22b..964ef3a257 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SpaceName.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/name/SpaceName.sarl
@@ -18,11 +18,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.name
import java.net.URI
import java.util.UUID
import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.lang.annotation.PrivateAPI
/**
* This class represents a space name.
@@ -31,7 +32,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class SpaceName extends SarlName {
@@ -47,7 +48,8 @@ class SpaceName extends SarlName {
* @param contextId the identifier of the context.
* @param spaceId the identifier of the context.
*/
- protected new (uri : URI, contextId : UUID, spaceId : UUID) {
+ @PrivateAPI
+ new (uri : URI, contextId : UUID, spaceId : UUID) {
super(uri)
this.contextId = contextId
this.spaceId = spaceId
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceService.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/AbstractNamespaceService.sarl
similarity index 72%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceService.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/AbstractNamespaceService.sarl
index 9a547a8c80..36b7a8a33b 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceService.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/AbstractNamespaceService.sarl
@@ -18,12 +18,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.services.namespace
+package io.sarl.api.naming.namespace
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.services.AbstractSreService
-import io.sarl.sre.naming.INameParser
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.namespace.NamespaceService
+import io.sarl.api.naming.parser.INameParser
import javax.inject.Inject
+import com.google.common.util.concurrent.AbstractService
/**
* Abstract implementation of a service that manages name spaces into the SRE.
@@ -32,12 +34,46 @@ import javax.inject.Inject
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
-abstract class AbstractNamespaceService extends AbstractSreService implements NamespaceService {
+abstract class AbstractNamespaceService extends AbstractService implements NamespaceService {
var nameParser : INameParser
+ protected final override doStart {
+ try {
+ onStart
+ notifyStarted
+ } catch (exception : Throwable) {
+ notifyFailed(exception)
+ }
+ }
+
+ /** Do something when starting the service.
+ *
+ * This function is called from {@link #doStart()}
+ */
+ protected def onStart {
+ //
+ }
+
+ protected final override doStop {
+ try {
+ onStop
+ notifyStopped
+ } catch (exception : Throwable) {
+ notifyFailed(exception)
+ }
+ }
+
+ /** Do something when stopping the service.
+ *
+ *
This function is called from {@link #doStop()}
+ */
+ protected def onStop {
+ //
+ }
+
@Pure
override getNameParser : INameParser {
this.nameParser
@@ -89,7 +125,7 @@ abstract class AbstractNamespaceService extends AbstractSreService implements Na
private static def getDeclaredField(obj : Object, name : SarlName) : FieldAccess {
var type = obj.class
- while (type !== null && typeof(Object) != type) {
+ while (type !== null && ( typeof(Object) != type )) {
try {
var field = type.getDeclaredField(name.fragment)
if (field !== null) {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/FieldAccess.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/FieldAccess.sarl
similarity index 96%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/FieldAccess.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/FieldAccess.sarl
index 97e28ae635..f51d17dcbf 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/FieldAccess.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/FieldAccess.sarl
@@ -18,9 +18,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.services.namespace
+package io.sarl.api.naming.namespace
-import io.sarl.sre.naming.SarlName
+import io.sarl.api.naming.name.SarlName
import java.lang.reflect.Field
import java.lang.reflect.Modifier
import org.eclipse.xtend.lib.annotations.Accessors
@@ -32,7 +32,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class FieldAccess {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/FinderBasedNamespaceService.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/FinderBasedNamespaceService.sarl
similarity index 76%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/FinderBasedNamespaceService.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/FinderBasedNamespaceService.sarl
index 30bf9ce847..8b7f79c574 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/FinderBasedNamespaceService.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/FinderBasedNamespaceService.sarl
@@ -18,22 +18,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.services.namespace
+package io.sarl.api.naming.namespace
-import io.sarl.sre.boot.internal.services.NamespaceFinders
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SarlName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
import java.util.Set
-import javax.inject.Inject
/**
* Implementation of a namespace service that uses the namespace finders.
+ * The finders are in charge of finding a specific type of element.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class FinderBasedNamespaceService extends AbstractNamespaceService {
@@ -41,14 +40,13 @@ class FinderBasedNamespaceService extends AbstractNamespaceService {
val finders = newTreeMap(null)
/** Change the set of namespace finders that is used by this service.
- *
- * This function is annoted in order to be used by the Guice injector.
+ *
+ *
This function could be overridden and annotated in subtypes in order to be used by the Guice injector.
*
* @param finders the set of finders.
*/
@SuppressWarnings("raw_type")
- @Inject
- def setNamespaceFinders(@NamespaceFinders finders : Set) {
+ def setNamespaceFinders(finders : Set) {
if (finders !== null) {
this.finders.clear
for (finder : finders) {
@@ -73,6 +71,11 @@ class FinderBasedNamespaceService extends AbstractNamespaceService {
this.finders.remove(scheme)
}
+ /** Find an object by ignoring the fragment component of the given name
+ *
+ * @param name the name of the element to search for.
+ * @return the element with the given name, or {@code null} it is was not found.
+ */
def findObjectWithoutFragment(name : SarlName) : Object {
val finder = this.finders.get(name.scheme)
if (finder !== null) {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/INamespaceFinder.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/INamespaceFinder.sarl
similarity index 76%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/INamespaceFinder.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/INamespaceFinder.sarl
index bdcdbb2db3..200dd821e2 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/INamespaceFinder.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/INamespaceFinder.sarl
@@ -18,13 +18,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.services.namespace
+package io.sarl.api.naming.namespace
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SarlName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
/**
- * An object that is able to find a specific type of obtain from a name.
+ * A tool that is able to find a specific type of object from a name into the SRE.
+ * Each type of element (agent, behavior, etc.) has a specific and dediciated implementation
+ * of finder. Of course, the finder's implementation depends strongly on the SRE implementation
+ * itself.
*
* @param the type of name that is supported by this finder.
* @param the type of object that is searching for.
@@ -32,7 +35,7 @@ import io.sarl.sre.naming.SarlName
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
interface INamespaceFinder {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/NamespaceService.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/NamespaceService.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/NamespaceService.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/NamespaceService.sarl
index 6d97b4a09e..06966ca968 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/NamespaceService.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/namespace/NamespaceService.sarl
@@ -18,11 +18,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.services.namespace
+package io.sarl.api.naming.namespace
import com.google.common.util.concurrent.Service
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.naming.INameParser
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.parser.INameParser
/**
* This service enables to manage the name spaces into the SRE.
@@ -33,7 +33,7 @@ import io.sarl.sre.naming.INameParser
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
interface NamespaceService extends Service {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AbstractSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/AbstractSchemeNameParser.sarl
similarity index 96%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AbstractSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/AbstractSchemeNameParser.sarl
index f6e494599d..2b0e8c10b5 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AbstractSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/AbstractSchemeNameParser.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
import java.util.StringTokenizer
import org.eclipse.xtend.lib.annotations.Accessors
@@ -32,7 +34,7 @@ import org.eclipse.xtend.lib.annotations.Accessors
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
abstract class AbstractSchemeNameParser implements ISchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AgentSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/AgentSchemeNameParser.sarl
similarity index 94%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AgentSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/AgentSchemeNameParser.sarl
index 57700b7534..067f02975d 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/AgentSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/AgentSchemeNameParser.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.api.naming.name.AgentName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
import java.util.StringTokenizer
import java.util.UUID
@@ -37,7 +39,7 @@ import java.util.UUID
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class AgentSchemeNameParser extends AbstractSchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/BehaviorSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/BehaviorSchemeNameParser.sarl
similarity index 96%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/BehaviorSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/BehaviorSchemeNameParser.sarl
index 1b5c7d9e42..ac02ff1524 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/BehaviorSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/BehaviorSchemeNameParser.sarl
@@ -18,13 +18,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.bootstrap.SREClassLoader
+import io.sarl.api.naming.name.BehaviorName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.core.Behavior
import java.net.URI
import java.util.StringTokenizer
import java.util.UUID
-import io.sarl.bootstrap.SREClassLoader
/**
* Parser of behavior names that is accepting URI-based syntax.
@@ -39,7 +41,7 @@ import io.sarl.bootstrap.SREClassLoader
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class BehaviorSchemeNameParser extends AbstractSchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ContextSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ContextSchemeNameParser.sarl
similarity index 92%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ContextSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ContextSchemeNameParser.sarl
index 5c93bc3f28..a8fe278344 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ContextSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ContextSchemeNameParser.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
import java.util.StringTokenizer
import java.util.UUID
@@ -35,7 +37,7 @@ import java.util.UUID
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class ContextSchemeNameParser extends AbstractSchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/INameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/INameParser.sarl
similarity index 89%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/INameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/INameParser.sarl
index 2c9851ebbc..4bc5c6e7a9 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/INameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/INameParser.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
/**
@@ -29,24 +31,10 @@ import java.net.URI
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
interface INameParser {
- /** Parse the scheme for a named object.
- */
- @Pure
- static def getSchemeObject(scheme : String) : NameScheme {
- if (scheme !== null) {
- for (s : NameScheme::values) {
- if (scheme.equalsIgnoreCase(s.name)) {
- return s
- }
- }
- }
- return null
- }
-
/**
* Parse the string representation of the name, and create the URI representation.
*
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ISchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ISchemeNameParser.sarl
similarity index 91%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ISchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ISchemeNameParser.sarl
index d81f09505f..ddd37d2b42 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ISchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ISchemeNameParser.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
/**
@@ -30,7 +32,7 @@ import java.net.URI
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
interface ISchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ServiceSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ServiceSchemeNameParser.sarl
similarity index 93%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ServiceSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ServiceSchemeNameParser.sarl
index 54a5f528ff..6b715a0a13 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/ServiceSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/ServiceSchemeNameParser.sarl
@@ -18,12 +18,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
import com.google.common.util.concurrent.Service
+import io.sarl.bootstrap.SREClassLoader
+import io.sarl.api.naming.name.ServiceName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
import java.util.StringTokenizer
-import io.sarl.bootstrap.SREClassLoader
/**
* Parser of service names that is accepting URI-based syntax.
@@ -36,7 +38,7 @@ import io.sarl.bootstrap.SREClassLoader
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class ServiceSchemeNameParser extends AbstractSchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SkillSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/SkillSchemeNameParser.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SkillSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/SkillSchemeNameParser.sarl
index 202af80eb7..cb005e6721 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SkillSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/SkillSchemeNameParser.sarl
@@ -18,13 +18,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.bootstrap.SREClassLoader
+import io.sarl.api.naming.name.SkillName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.core.Capacity
import java.net.URI
import java.util.StringTokenizer
import java.util.UUID
-import io.sarl.bootstrap.SREClassLoader
/**
* Parser of skill names that is accepting URI-based syntax.
@@ -39,7 +41,7 @@ import io.sarl.bootstrap.SREClassLoader
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class SkillSchemeNameParser extends AbstractSchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SpaceSchemeNameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/SpaceSchemeNameParser.sarl
similarity index 93%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SpaceSchemeNameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/SpaceSchemeNameParser.sarl
index c827fd37d7..a1b9602408 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/SpaceSchemeNameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/SpaceSchemeNameParser.sarl
@@ -18,8 +18,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
+import io.sarl.api.naming.name.SpaceName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
import java.util.StringTokenizer
import java.util.UUID
@@ -35,7 +37,7 @@ import java.util.UUID
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
class SpaceSchemeNameParser extends AbstractSchemeNameParser {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/NameParser.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/UriBasedNameParser.sarl
similarity index 75%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/NameParser.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/UriBasedNameParser.sarl
index ce48a61476..d0f207a903 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/NameParser.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/parser/UriBasedNameParser.sarl
@@ -18,35 +18,47 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.parser
-import io.sarl.sre.boot.internal.naming.SchemeNameParsers
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
import java.net.URI
import java.util.Set
-import javax.inject.Inject
+
+import static extension io.sarl.api.naming.scheme.NameSchemes.*
/**
- * Parser of names that is accepting URI-based syntax.
+ * Default implementation of a parser of names that is accepting URI-based syntax.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
-class NameParser implements INameParser {
+class UriBasedNameParser implements INameParser {
val schemeNameParser = >newTreeMap(null)
+ /** Construct a name parser based on the given scheme parsers.
+ *
+ * @param parsers the set of scheme name parsers.
+ */
+ @SuppressWarnings("raw_type")
+ new (parsers : Set = null) {
+ if (parsers !== null && !parsers.isEmpty) {
+ setSchemeNameParsers(parsers);
+ }
+ }
+
/** Change the set of scheme name parsers that is used by this base name parser.
*
- * This function is annotated in order to be used by the Guice injector.
+ *
This function could be overridden and annotated in subtypes in order to be used by the Guice injector.
*
* @param parsers the set of scheme name parsers.
*/
@SuppressWarnings("raw_type")
- @Inject
- def setSchemeNameParsers(@SchemeNameParsers parsers : Set) {
+ def setSchemeNameParsers(parsers : Set) {
if (parsers !== null) {
this.schemeNameParser.clear
for (parser : parsers) {
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/NameScheme.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/scheme/NameScheme.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/NameScheme.sarl
rename to main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/scheme/NameScheme.sarl
index f1a9c52c99..52687d2a8d 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/naming/NameScheme.sarl
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/scheme/NameScheme.sarl
@@ -18,7 +18,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.sarl.sre.naming
+package io.sarl.api.naming.scheme
/**
* Name of a scheme that is supported for names' specification.
@@ -27,7 +27,7 @@ package io.sarl.sre.naming
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
- * @since 0.10
+ * @since 0.12
*/
enum NameScheme {
CONTEXT, SPACE, AGENT, SKILL, BEHAVIOR, SERVICE
diff --git a/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/scheme/NameSchemes.sarl b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/scheme/NameSchemes.sarl
new file mode 100644
index 0000000000..d7cdb9accc
--- /dev/null
+++ b/main/apiplugins/io.sarl.api.naming/src/main/sarl/io/sarl/api/naming/scheme/NameSchemes.sarl
@@ -0,0 +1,51 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.scheme
+
+/**
+ * Utilities for name schemes.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+final class NameSchemes {
+
+ private new {
+ }
+
+ /** Parse the scheme for a named object.
+ */
+ @Pure
+ static def getSchemeObject(scheme : String) : NameScheme {
+ if (scheme !== null) {
+ for (s : NameScheme::values) {
+ if (scheme.equalsIgnoreCase(s.name)) {
+ return s
+ }
+ }
+ }
+ return null
+ }
+
+}
diff --git a/main/apiplugins/pom.xml b/main/apiplugins/pom.xml
index 17b4631c59..1308d0e092 100644
--- a/main/apiplugins/pom.xml
+++ b/main/apiplugins/pom.xml
@@ -22,6 +22,7 @@
io.sarl.util
io.sarl.core
+ io.sarl.api.naming
io.sarl.api.bootiquebase
diff --git a/main/externalmaven/io.sarl.maven.sdk/pom.xml b/main/externalmaven/io.sarl.maven.sdk/pom.xml
index 8892f3e1a3..961aba6e69 100644
--- a/main/externalmaven/io.sarl.maven.sdk/pom.xml
+++ b/main/externalmaven/io.sarl.maven.sdk/pom.xml
@@ -26,6 +26,10 @@
io.sarl
io.sarl.util
+
+ io.sarl
+ io.sarl.api.naming
+
diff --git a/main/features/io.sarl.lib/feature.xml b/main/features/io.sarl.lib/feature.xml
index 43a8d8365e..7f42a72c3a 100644
--- a/main/features/io.sarl.lib/feature.xml
+++ b/main/features/io.sarl.lib/feature.xml
@@ -224,10 +224,10 @@
+
-
@@ -267,4 +267,10 @@
version="0.0.0"
unpack="false"/>
+
+
diff --git a/pom.xml b/pom.xml
index 14581d53cb..88d98fd28e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -342,6 +342,11 @@
io.sarl.util
${sarl.version}
+
+ io.sarl
+ io.sarl.api.naming
+ ${sarl.version}
+
io.sarl
io.sarl.api.bootiquebase
diff --git a/sre/io.janusproject/io.janusproject.eclipse/src/io/sarl/sre/eclipse/buildpath/janus-bundles.properties b/sre/io.janusproject/io.janusproject.eclipse/src/io/sarl/sre/eclipse/buildpath/janus-bundles.properties
index 79fbcadae3..ed970120d4 100644
--- a/sre/io.janusproject/io.janusproject.eclipse/src/io/sarl/sre/eclipse/buildpath/janus-bundles.properties
+++ b/sre/io.janusproject/io.janusproject.eclipse/src/io/sarl/sre/eclipse/buildpath/janus-bundles.properties
@@ -1,3 +1,3 @@
# This file is automatically generated by Maven. Please do not edit manually.
-JANUS_BUNDLES = io.janusproject.plugin, io.sarl.core, io.sarl.util, io.sarl.api.bootiquebase, io.bootique, org.arakhne.afc.bootique.variables, com.google.inject, javax.inject, org.eclipse.osgi, org.eclipse.xtend.lib, org.arakhne.afc.core.util, org.arakhne.afc.core.inputoutput, com.fasterxml.jackson.core.jackson-annotations
+JANUS_BUNDLES = io.janusproject.plugin, io.sarl.core, io.sarl.util, io.sarl.api.naming, io.sarl.api.bootiquebase, io.bootique, org.arakhne.afc.bootique.variables, com.google.inject, javax.inject, org.eclipse.osgi, org.eclipse.xtend.lib, org.arakhne.afc.core.util, org.arakhne.afc.core.inputoutput, com.fasterxml.jackson.core.jackson-annotations
JANUS_ECLIPSE_BUNDLES = io.sarl.eclipse, org.eclipse.jdt.core, org.eclipse.core.runtime, org.eclipse.ui.workbench, org.eclipse.jdt.ui, org.eclipse.jface, org.eclipse.swt, org.eclipse.jdt.launching, com.fasterxml.jackson.core.jackson-core, com.fasterxml.jackson.core.jackson-databind, com.fasterxml.jackson.dataformat.jackson-dataformat-yaml
diff --git a/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF b/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF
index 9654777a9c..f8955d1d20 100644
--- a/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF
+++ b/sre/io.janusproject/io.janusproject.plugin/META-INF/MANIFEST.MF
@@ -9,6 +9,7 @@ Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: io.sarl.core;bundle-version="0.12.0",
io.sarl.util;bundle-version="0.12.0",
+ io.sarl.api.naming;bundle-version="0.12.0",
io.sarl.api.bootiquebase;bundle-version="0.12.0",
io.bootique;bundle-version="1.1.0",
org.arakhne.afc.bootique.variables;bundle-version="16.0.0",
@@ -80,7 +81,6 @@ Export-Package: io.sarl.sre;
com.google.inject,
org.eclipse.osgi.util,
io.sarl.sre.services.executor,
- io.sarl.sre.naming,
org.arakhne.afc.bootique.log4j.configs,
javax.inject",
io.sarl.sre.boot.internal.skills;
@@ -102,7 +102,6 @@ Export-Package: io.sarl.sre;
org.arakhne.afc.util,
io.sarl.sre.services.lifecycle",
io.sarl.sre.internal.eventguard,
- io.sarl.sre.naming,
io.sarl.sre.services;
uses:="io.sarl.sre.boot.configs,
org.eclipse.osgi.util,
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/NameParserModule.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/NameParserModule.sarl
index a28c63af69..355a3b4ce1 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/NameParserModule.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/NameParserModule.sarl
@@ -24,8 +24,11 @@ import com.google.inject.AbstractModule
import com.google.inject.Module
import io.bootique.BQModule
import io.bootique.BQModuleProvider
-import io.sarl.sre.naming.INameParser
-import io.sarl.sre.naming.NameParser
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.parser.INameParser
+import io.sarl.api.naming.parser.ISchemeNameParser
+import java.util.Set
+import javax.inject.Inject
import javax.inject.Singleton
/**
@@ -40,7 +43,26 @@ import javax.inject.Singleton
class NameParserModule extends AbstractModule {
protected override configure {
- typeof(INameParser).bind.to(typeof(NameParser)).in(typeof(Singleton))
+ typeof(INameParser).bind.to(typeof(InjectedNameParser)).in(typeof(Singleton))
+ }
+
+ /**
+ * Injectable implementation of the name parser.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+ static class InjectedNameParser extends UriBasedNameParser {
+
+ @SuppressWarnings("raw_type")
+ @Inject
+ override setSchemeNameParsers(@SchemeNameParsers parsers : Set) {
+ super.setSchemeNameParsers(parsers)
+ }
+
}
}
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/SchemeNameParserModule.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/SchemeNameParserModule.sarl
index a6479c9f0a..937a91e76d 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/SchemeNameParserModule.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/naming/SchemeNameParserModule.sarl
@@ -25,13 +25,13 @@ import com.google.inject.BindingAnnotation
import com.google.inject.Module
import io.bootique.BQModule
import io.bootique.BQModuleProvider
-import io.sarl.sre.naming.AgentSchemeNameParser
-import io.sarl.sre.naming.BehaviorSchemeNameParser
-import io.sarl.sre.naming.ContextSchemeNameParser
-import io.sarl.sre.naming.ISchemeNameParser
-import io.sarl.sre.naming.ServiceSchemeNameParser
-import io.sarl.sre.naming.SkillSchemeNameParser
-import io.sarl.sre.naming.SpaceSchemeNameParser
+import io.sarl.api.naming.parser.AgentSchemeNameParser
+import io.sarl.api.naming.parser.BehaviorSchemeNameParser
+import io.sarl.api.naming.parser.ContextSchemeNameParser
+import io.sarl.api.naming.parser.ISchemeNameParser
+import io.sarl.api.naming.parser.ServiceSchemeNameParser
+import io.sarl.api.naming.parser.SkillSchemeNameParser
+import io.sarl.api.naming.parser.SpaceSchemeNameParser
import java.lang.annotation.Retention
import java.lang.annotation.Target
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceFinderModule.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceFinderModule.sarl
index dbe00a81d2..794b365563 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceFinderModule.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceFinderModule.sarl
@@ -25,10 +25,10 @@ import com.google.inject.BindingAnnotation
import com.google.inject.Module
import io.bootique.BQModule
import io.bootique.BQModuleProvider
+import io.sarl.api.naming.namespace.INamespaceFinder
import io.sarl.sre.services.namespace.AgentNamespaceFinder
import io.sarl.sre.services.namespace.BehaviorNamespaceFinder
import io.sarl.sre.services.namespace.ContextNamespaceFinder
-import io.sarl.sre.services.namespace.INamespaceFinder
import io.sarl.sre.services.namespace.ServiceNamespaceFinder
import io.sarl.sre.services.namespace.SkillNamespaceFinder
import io.sarl.sre.services.namespace.SpaceNamespaceFinder
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceServiceModule.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceServiceModule.sarl
index f613ab6a2c..e723ff6cbc 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceServiceModule.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/NamespaceServiceModule.sarl
@@ -25,8 +25,11 @@ import com.google.inject.AbstractModule
import com.google.inject.Module
import io.bootique.BQModule
import io.bootique.BQModuleProvider
-import io.sarl.sre.services.namespace.FinderBasedNamespaceService
-import io.sarl.sre.services.namespace.NamespaceService
+import io.sarl.api.naming.namespace.FinderBasedNamespaceService
+import io.sarl.api.naming.namespace.INamespaceFinder
+import io.sarl.api.naming.namespace.NamespaceService
+import java.util.Set
+import javax.inject.Inject
import javax.inject.Singleton
import static extension com.google.inject.multibindings.Multibinder.*
@@ -43,11 +46,30 @@ import static extension com.google.inject.multibindings.Multibinder.*
class NamespaceServiceModule extends AbstractModule {
protected override configure {
- typeof(NamespaceService).bind.to(typeof(FinderBasedNamespaceService)).in(typeof(Singleton))
+ typeof(NamespaceService).bind.to(typeof(InjectedFinderBasedNamespaceService)).in(typeof(Singleton))
binder.newSetBinder(typeof(Service), typeof(SreServices)).addBinding.to(typeof(NamespaceService))
}
+ /**
+ * Injectable implementation of the name space service.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ * @since 0.12
+ */
+ static class InjectedFinderBasedNamespaceService extends FinderBasedNamespaceService {
+
+ @SuppressWarnings("raw_type")
+ @Inject
+ def setNamespaceFinders(finders : Set) {
+ super.setNamespaceFinders(finders)
+ }
+
+ }
+
}
/** Provider of the module for the namespace services.
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/ProbeServiceModule.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/ProbeServiceModule.sarl
index 24c933dd45..b38578398f 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/ProbeServiceModule.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/boot/internal/services/ProbeServiceModule.sarl
@@ -27,11 +27,11 @@ import com.google.inject.Module
import com.google.inject.Provides
import io.bootique.BQModule
import io.bootique.BQModuleProvider
+import io.sarl.api.naming.namespace.NamespaceService
+import io.sarl.api.naming.parser.INameParser
import io.sarl.sre.boot.configs.SreConfig
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.NameParser
import io.sarl.sre.services.executor.ExecutorService
-import io.sarl.sre.services.namespace.NamespaceService
import io.sarl.sre.services.probing.AsynchronousProbeService
import io.sarl.sre.services.probing.ProbeService
import io.sarl.sre.services.probing.SynchronousProbeService
@@ -66,7 +66,7 @@ class ProbeServiceModule extends AbstractModule {
@Provides
def providesProbeService(sreConfig : Provider, injector : Injector,
service : Provider, namespaceService : Provider,
- nameParser : Provider,
+ nameParser : Provider,
listenerCollectionProvider : Provider>) : ProbeService {
var ps : ProbeService
var cfgInstance = sreConfig.get
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceFinder.sarl
index 2e7883f11d..903e051e89 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AbstractNamespaceFinder.sarl
@@ -20,11 +20,12 @@
*/
package io.sarl.sre.services.namespace
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.INamespaceFinder
import io.sarl.lang.annotation.PrivateAPI
import io.sarl.lang.core.Agent
import io.sarl.lang.core.Space
import io.sarl.sre.capacities.InformedEventListener
-import io.sarl.sre.naming.SarlName
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import io.sarl.sre.spaces.SpaceWithParticipants
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AgentNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AgentNamespaceFinder.sarl
index 7fef3ad641..751ae44670 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AgentNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/AgentNamespaceFinder.sarl
@@ -20,9 +20,9 @@
*/
package io.sarl.sre.services.namespace
+import io.sarl.api.naming.name.AgentName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.core.Agent
-import io.sarl.sre.naming.AgentName
-import io.sarl.sre.naming.NameScheme
import io.sarl.sre.services.context.ContextService
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/BehaviorNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/BehaviorNamespaceFinder.sarl
index 72c9446e8d..91b043f850 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/BehaviorNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/BehaviorNamespaceFinder.sarl
@@ -20,12 +20,12 @@
*/
package io.sarl.sre.services.namespace
+import io.sarl.api.naming.name.BehaviorName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.core.Behaviors
import io.sarl.lang.annotation.PrivateAPI
import io.sarl.lang.core.Behavior
import io.sarl.lang.core.SREutils
-import io.sarl.sre.naming.BehaviorName
-import io.sarl.sre.naming.NameScheme
import io.sarl.sre.services.context.ContextService
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ContextNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ContextNamespaceFinder.sarl
index 9076cf8925..668ca2bc7e 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ContextNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ContextNamespaceFinder.sarl
@@ -20,8 +20,8 @@
*/
package io.sarl.sre.services.namespace
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.naming.NameScheme
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import javax.inject.Inject
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ServiceNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ServiceNamespaceFinder.sarl
index 5a0a991b5b..c050a34234 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ServiceNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/ServiceNamespaceFinder.sarl
@@ -22,10 +22,11 @@ package io.sarl.sre.services.namespace
import com.google.common.util.concurrent.Service
import com.google.inject.Injector
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.ServiceName
-import org.eclipse.xtend.lib.annotations.Accessors
+import io.sarl.api.naming.name.ServiceName
+import io.sarl.api.naming.namespace.INamespaceFinder
+import io.sarl.api.naming.scheme.NameScheme
import javax.inject.Inject
+import org.eclipse.xtend.lib.annotations.Accessors
/**
* Implementation of a finder of service into the namespaces.
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SkillNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SkillNamespaceFinder.sarl
index fc77d2335f..0d6ac43e49 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SkillNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SkillNamespaceFinder.sarl
@@ -20,12 +20,12 @@
*/
package io.sarl.sre.services.namespace
+import io.sarl.api.naming.name.SkillName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.annotation.PrivateAPI
import io.sarl.lang.core.SREutils
import io.sarl.lang.core.Skill
import io.sarl.lang.core.UnimplementedCapacityException
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SkillName
import io.sarl.sre.services.context.ContextService
import javax.inject.Inject
import javax.inject.Singleton
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SpaceNamespaceFinder.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SpaceNamespaceFinder.sarl
index 1b8f00cc53..f144f30cf1 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SpaceNamespaceFinder.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/namespace/SpaceNamespaceFinder.sarl
@@ -20,9 +20,9 @@
*/
package io.sarl.sre.services.namespace
+import io.sarl.api.naming.name.SpaceName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.core.Space
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SpaceName
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import javax.inject.Inject
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractFieldProbe.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractFieldProbe.sarl
index 8e341df7fd..d1fd9ba1e1 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractFieldProbe.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractFieldProbe.sarl
@@ -21,14 +21,14 @@
package io.sarl.sre.services.probing
import com.google.common.util.concurrent.Service
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.core.Agent
import io.sarl.lang.core.AgentTrait
import io.sarl.lang.core.Behavior
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.NameScheme
import io.sarl.sre.services.lifecycle.AgentLife
import io.sarl.sre.services.lifecycle.BehaviorLife
-import io.sarl.sre.services.namespace.FieldAccess
import java.net.URI
import javax.inject.Provider
import org.eclipse.xtend.lib.annotations.Accessors
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractProbeService.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractProbeService.sarl
index 928ec7118b..76c2389775 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractProbeService.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AbstractProbeService.sarl
@@ -20,18 +20,18 @@
*/
package io.sarl.sre.services.probing
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.parser.INameParser
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
import io.sarl.sre.services.AbstractSreService
-import io.sarl.sre.services.namespace.FieldAccess
-import io.sarl.sre.services.namespace.NamespaceService
import java.net.URI
import java.util.Collection
import java.util.Map
import java.util.UUID
import java.util.concurrent.ConcurrentLinkedDeque
import javax.inject.Provider
+import io.sarl.api.naming.namespace.NamespaceService
/**
* This class is the standard implementation of a probe service.
@@ -46,7 +46,7 @@ abstract class AbstractProbeService extends AbstractSreService implements ProbeS
val namespace : NamespaceService
- val nameParser : NameParser
+ val nameParser : INameParser
val probes : Map>
@@ -60,7 +60,7 @@ abstract class AbstractProbeService extends AbstractSreService implements ProbeS
* @param listenerCollectionProvider the provider of listener collections.
* @param lockProvider the provider of synchronization locks.
*/
- protected new (internalStructure : Map>, namespaceService : NamespaceService, nameParser : NameParser,
+ protected new (internalStructure : Map>, namespaceService : NamespaceService, nameParser : INameParser,
listenerCollectionProvider : Provider>) {
this.probes = internalStructure
this.namespace = namespaceService
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AsynchronousProbeService.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AsynchronousProbeService.sarl
index 78de235921..5d02f1333c 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AsynchronousProbeService.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/AsynchronousProbeService.sarl
@@ -21,15 +21,15 @@
package io.sarl.sre.services.probing
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.NameParser
import io.sarl.sre.services.executor.ExecutorService
import io.sarl.sre.services.executor.Runnables
-import io.sarl.sre.services.namespace.NamespaceService
+import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.atomic.AtomicBoolean
import javax.inject.Inject
import javax.inject.Provider
import org.eclipse.xtend.lib.annotations.Accessors
-import java.util.concurrent.ConcurrentHashMap
+import io.sarl.api.naming.parser.INameParser
+import io.sarl.api.naming.namespace.NamespaceService
/**
* This class is the implementation of a probe service that is updating the values asynchronously.
@@ -62,7 +62,7 @@ class AsynchronousProbeService extends AbstractProbeService {
* @param lockProvider the provider of synchronization locks.
*/
@Inject
- new (service : ExecutorService, namespaceService : NamespaceService, nameParser : NameParser,
+ new (service : ExecutorService, namespaceService : NamespaceService, nameParser : INameParser,
listenerCollectionProvider : Provider>) {
super(new ConcurrentHashMap, namespaceService, nameParser, listenerCollectionProvider)
this.executor = service
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/FieldProbe.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/FieldProbe.sarl
index 836f5cf1ed..e13b3fc0f5 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/FieldProbe.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/FieldProbe.sarl
@@ -20,8 +20,8 @@
*/
package io.sarl.sre.services.probing
+import io.sarl.api.naming.namespace.FieldAccess
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.services.namespace.FieldAccess
import java.net.URI
import javax.inject.Provider
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/ProbeService.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/ProbeService.sarl
index c2db0edbeb..aeee57973f 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/ProbeService.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/ProbeService.sarl
@@ -21,7 +21,7 @@
package io.sarl.sre.services.probing
import com.google.common.util.concurrent.Service
-import io.sarl.sre.naming.SarlName
+import io.sarl.api.naming.name.SarlName
import java.net.URI
import java.util.Collection
diff --git a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/SynchronousProbeService.sarl b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/SynchronousProbeService.sarl
index 1797ac271d..61f81ce354 100644
--- a/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/SynchronousProbeService.sarl
+++ b/sre/io.janusproject/io.janusproject.plugin/src/main/sarl/io/sarl/sre/services/probing/SynchronousProbeService.sarl
@@ -20,14 +20,14 @@
*/
package io.sarl.sre.services.probing
+import io.sarl.api.naming.parser.INameParser
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.services.namespace.NamespaceService
import java.net.URI
import java.util.HashMap
import java.util.Map
import javax.inject.Inject
import javax.inject.Provider
+import io.sarl.api.naming.namespace.NamespaceService
/**
* This class is the implementation of a probe service that is updating the values synchronously.
@@ -50,7 +50,7 @@ class SynchronousProbeService extends AbstractProbeService {
* @param lockProvider the provider of synchronization locks.
*/
@Inject
- new (namespaceService : NamespaceService, nameParser : NameParser,
+ new (namespaceService : NamespaceService, nameParser : INameParser,
listenerCollectionProvider : Provider>) {
this(new HashMap, namespaceService, nameParser, listenerCollectionProvider)
}
@@ -63,7 +63,7 @@ class SynchronousProbeService extends AbstractProbeService {
* @param listenerCollectionProvider the provider of listener collections.
* @param lockProvider the provider of synchronization locks.
*/
- new (internalStructure : Map>, namespaceService : NamespaceService, nameParser : NameParser,
+ new (internalStructure : Map>, namespaceService : NamespaceService, nameParser : INameParser,
listenerCollectionProvider : Provider>) {
super(internalStructure, namespaceService, nameParser, listenerCollectionProvider)
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/AbstractNamespaceServiceTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/AbstractNamespaceServiceTest.sarl
index ba5251b681..3064ab0d38 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/AbstractNamespaceServiceTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/AbstractNamespaceServiceTest.sarl
@@ -21,7 +21,7 @@
package io.sarl.sre.tests.runtime.services.namespace
-import io.sarl.sre.services.namespace.NamespaceService
+import io.sarl.api.naming.namespace.NamespaceService
import io.sarl.sre.test.framework.context.SreRunContext
import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
import io.sarl.sre.test.framework.^extension.SreRunExtension
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/FinderBasedNamespaceServiceTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/FinderBasedNamespaceServiceTest.sarl
index 8dadcdfc55..d7d7c4abf6 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/FinderBasedNamespaceServiceTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/runtime/services/namespace/FinderBasedNamespaceServiceTest.sarl
@@ -21,7 +21,7 @@
package io.sarl.sre.tests.runtime.services.namespace
-import io.sarl.sre.services.namespace.FieldAccess
+import io.sarl.api.naming.namespace.FieldAccess
import io.sarl.sre.test.framework.context.SreRunContext
import java.util.UUID
import org.junit.jupiter.api.DisplayName
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/BehaviorSchemeNameParserTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/BehaviorSchemeNameParserTest.sarl
deleted file mode 100644
index b1e64d2615..0000000000
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/BehaviorSchemeNameParserTest.sarl
+++ /dev/null
@@ -1,1353 +0,0 @@
-/*
- * $Id$
- *
- * SARL is an general-purpose agent programming language.
- * More details on http://www.sarl.io
- *
- * Copyright (C) 2014-2020 the original authors or authors.
- *
- * Licensed 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 io.sarl.sre.tests.units.naming
-
-import io.sarl.sre.naming.BehaviorName
-import io.sarl.sre.naming.BehaviorSchemeNameParser
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
-import io.sarl.sre.tests.units.naming.mocks.BehaviorMock
-import io.sarl.sre.tests.units.naming.mocks.CapacityMock
-import io.sarl.tests.api.Nullable
-import io.sarl.tests.api.extensions.ContextInitExtension
-import io.sarl.tests.api.extensions.JavaVersionCheckExtension
-import java.net.URI
-import java.util.UUID
-import org.junit.jupiter.api.BeforeEach
-import org.junit.jupiter.api.DisplayName
-import org.junit.jupiter.api.Tag
-import org.junit.jupiter.api.Test
-import org.junit.jupiter.api.^extension.ExtendWith
-
-import static extension io.sarl.tests.api.tools.TestAssertions.assertNullOrEmpty
-import static extension org.junit.jupiter.api.Assertions.assertEquals
-import static extension org.junit.jupiter.api.Assertions.assertNotNull
-import static extension org.junit.jupiter.api.Assertions.assertNull
-
-/**
- * @author $Author: sgalland$
- * @version $FullVersion$
- * @mavengroupid $GroupId$
- * @mavenartifactid $ArtifactId$
- */
-@ExtendWith(#[
- typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
-])
-@DisplayName("unit: behavior NameParser test")
-@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
-class BehaviorSchemeNameParserTest {
-
- protected static val CONTEXT_ID = "2a2c6de4-8327-431b-a916-97a05caafe14"
-
- protected static val SPACE_ID = "bb0d92be-1730-4453-a284-bd66d31b853f"
-
- protected static val AGENT_ID = "a0875b30-cff3-4461-9b96-f501e6c6a788"
-
- protected static val SKILL_ID = typeof(CapacityMock).name
-
- protected static val BEHAVIOR_ID = typeof(BehaviorMock).name
-
- protected static val BEHAVIOR_IDX = 8
-
- @Nullable
- var parser : NameParser
-
- @BeforeEach
- def setUp : void {
- this.parser = new NameParser
- this.parser.addSchemeNameParser(new BehaviorSchemeNameParser)
- }
-
- protected static def createURI(value : String) : URI {
- URI::create(value)
- }
-
- protected def createNormalizedURI(value : String) : URI {
- this.parser.normalize(value.createURI)
- }
-
- private static def toUUID(s : String) : UUID {
- UUID::fromString(s)
- }
-
- private static def m(index : int, e : String*) : String{
- val b = new StringBuilder
- for (elt : e) {
- if (!elt.isNullOrEmpty) {
- b.append("/").append(elt)
- }
- }
- if (index >= 0) {
- b.append("/").append(index)
- }
- return b.toString
- }
-
- protected static def assertValid(uri : URI, s : String, fragment : String = null, kindex : int, elements : String*) : void {
- uri.assertNotNull
- s.assertEquals(uri.scheme)
- m(kindex, elements).assertEquals(uri.path)
- if (fragment.isNullOrEmpty) {
- uri.fragment.assertNullOrEmpty
- } else {
- fragment.assertEquals(uri.fragment)
- }
- uri.host.assertNullOrEmpty
- uri.port.assertEquals(-1)
- uri.query.assertNullOrEmpty
- uri.userInfo.assertNullOrEmpty
- }
-
- protected static def assertValid(name : SarlName, s : String, fragment : String = null, kindex : int, elements : String*) : void {
- name.assertNotNull
- name.toURI.assertValid(s, fragment, kindex, elements)
- if (fragment.isNullOrEmpty) {
- name.fragment.assertNullOrEmpty
- } else {
- fragment.assertEquals(name.fragment)
- }
- val n = name as BehaviorName
- if (n.contextId === null) {
- n.contextId.assertNull
- n.spaceId.assertNull
- elements.get(0).toUUID.assertEquals(n.agentId)
- elements.get(1).assertEquals(n.behaviorType.name)
- if (elements.length != 2) {
- 3.assertEquals(elements.length)
- elements.get(2).assertEquals(BEHAVIOR_IDX)
- }
- } else if (n.spaceId === null) {
- elements.get(0).toUUID.assertEquals(n.contextId)
- n.spaceId.assertNull
- elements.get(1).toUUID.assertEquals(n.agentId)
- elements.get(2).assertEquals(n.behaviorType.name)
- if (elements.length != 3) {
- 4.assertEquals(elements.length)
- elements.get(3).assertEquals(BEHAVIOR_IDX)
- }
- } else {
- elements.get(0).toUUID.assertEquals(n.contextId)
- elements.get(1).toUUID.assertEquals(n.spaceId)
- elements.get(2).toUUID.assertEquals(n.agentId)
- elements.get(3).assertEquals(n.behaviorType.name)
- if (elements.length != 4) {
- 5.assertEquals(elements.length)
- elements.get(4).assertEquals(BEHAVIOR_IDX)
- }
- }
- }
-
- @Test
- def decode_String_00 {
- this.parser.decode("behavior:").assertNull
- }
-
- @Test
- def decode_String_01 {
- this.parser.decode("behavior://" + BEHAVIOR_ID).assertNull
- }
-
- @Test
- def decode_String_02 {
- this.parser.decode("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).assertNull
- }
-
- @Test
- def decode_String_03 {
- this.parser.decode("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid(
- "behavior", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_04 {
- this.parser.decode("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).assertValid("behavior",
- BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_05 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid("behavior", -1,
- CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_06 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_07 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid(
- "behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_08 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_09 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx").
- assertNull
- }
-
- @Test
- def decode_String_10 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx").assertNull
- }
-
- @Test
- def decode_String_11 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).assertNull
- }
-
- @Test
- def decode_String_12 {
- this.parser.decode("behavior:/" + BEHAVIOR_ID).assertNull
- }
-
- @Test
- def decode_String_13 {
- this.parser.decode("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).assertNull
- }
-
- @Test
- def decode_String_14 {
- this.parser.decode("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid("behavior", -1, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_15 {
- this.parser.decode("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_16 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid("behavior",
- -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_17 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_18 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_19 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_20 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").assertNull
- }
-
- @Test
- def decode_String_21 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx").assertNull
- }
-
- @Test
- def decode_String_22 {
- this.parser.decode(
- "behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).assertNull
- }
-
- @Test
- def decode_String_23 {
- this.parser.decode("behavior:" + BEHAVIOR_ID).assertNull
- }
-
- @Test
- def decode_String_24 {
- this.parser.decode("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).assertNull
- }
-
- @Test
- def decode_String_25 {
- this.parser.decode("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid("behavior", -1, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_26 {
- this.parser.decode("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_27 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).assertValid("behavior",
- -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_28 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_29 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_30 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_31 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").assertNull
- }
-
- @Test
- def decode_String_32 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx").assertNull
- }
-
- @Test
- def decode_String_33 {
- this.parser.decode(
- "behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).assertNull
- }
-
- @Test
- def decode_String_fragment_00 {
- this.parser.decode("behavior:#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_01 {
- this.parser.decode("behavior://" + BEHAVIOR_ID + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_02 {
- this.parser.decode("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_03 {
- this.parser.decode("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").assertValid("behavior",
- "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_04 {
- this.parser.decode("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").
- assertValid("behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_05 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").
- assertValid("behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_06 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX
- + "#frag").assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_07 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID
- + "#frag").assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_08 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_09 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_10 {
- this.parser.decode("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_11 {
- this.parser.decode(
- "behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_12 {
- this.parser.decode("behavior:/" + BEHAVIOR_ID + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_13 {
- this.parser.decode("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_14 {
- this.parser.decode("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").assertValid("behavior",
- "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_15 {
- this.parser.decode("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").assertValid(
- "behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_16 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").assertValid(
- "behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_17 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX
- + "#frag").assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_18 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").
- assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_19 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_20 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_21 {
- this.parser.decode("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_22 {
- this.parser.decode(
- "behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_23 {
- this.parser.decode("behavior:" + BEHAVIOR_ID + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_24 {
- this.parser.decode("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_25 {
- this.parser.decode("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").assertValid("behavior", "frag", -1,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_26 {
- this.parser.decode("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").assertValid(
- "behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_27 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").assertValid(
- "behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_28 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "#frag").assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_29 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").
- assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_30 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def decode_String_fragment_31 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_32 {
- this.parser.decode("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").assertNull
- }
-
- @Test
- def decode_String_fragment_33 {
- this.parser.decode(
- "behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").assertNull
- }
-
- @Test
- def normalize_URI_00 {
- this.parser.normalize(("behavior://" + BEHAVIOR_ID).createURI).assertNull
- }
-
- @Test
- def normalize_URI_01 {
- this.parser.normalize(("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).assertNull
- }
-
- @Test
- def normalize_URI_02 {
- this.parser.normalize(("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).assertValid("behavior", -1,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_03 {
- this.parser.normalize(("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_04 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).
- assertValid("behavior", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_05 {
- this.parser.normalize(
- ("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_06 {
- this.parser.normalize(
- ("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_07 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX).createURI).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_08 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").createURI).assertNull
- }
-
- @Test
- def normalize_URI_09 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx").createURI).assertNull
- }
-
- @Test
- def normalize_URI_10 {
- this.parser.normalize((
- "behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).createURI).assertNull
- }
-
- @Test
- def normalize_URI_11 {
- this.parser.normalize(("behavior:/" + BEHAVIOR_ID).createURI).assertNull
- }
-
- @Test
- def normalize_URI_12 {
- this.parser.normalize(("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).assertNull
- }
-
- @Test
- def normalize_URI_13 {
- this.parser.normalize(("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).assertValid("behavior", -1,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_14 {
- this.parser.normalize(("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_15 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).
- assertValid("behavior", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_16 {
- this.parser.normalize(
- ("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_17 {
- this.parser.normalize(
- ("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_18 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX).createURI).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_19 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").createURI).assertNull
- }
-
- @Test
- def normalize_URI_20 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx").createURI).assertNull
- }
-
- @Test
- def normalize_URI_21 {
- this.parser.normalize((
- "behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).createURI).assertNull
- }
-
- @Test
- def normalize_URI_22 {
- this.parser.normalize(("behavior:" + BEHAVIOR_ID).createURI).assertNull
- }
-
- @Test
- def normalize_URI_23 {
- this.parser.normalize(("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).assertNull
- }
-
- @Test
- def normalize_URI_24 {
- this.parser.normalize(("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).assertValid("behavior", -1,
- AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_25 {
- this.parser.normalize(("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_26 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).
- assertValid("behavior", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_27 {
- this.parser.normalize(
- ("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createURI).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_28 {
- this.parser.normalize(
- ("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createURI).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_29 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX).createURI).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_30 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").createURI).assertNull
- }
-
- @Test
- def normalize_URI_31 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx").createURI).assertNull
- }
-
- @Test
- def normalize_URI_32 {
- this.parser.normalize((
- "behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_00 {
- this.parser.normalize(("behavior://" + BEHAVIOR_ID + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_01 {
- this.parser.normalize(("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_02 {
- this.parser.normalize(("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createURI).
- assertValid("behavior", "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_03 {
- this.parser.normalize(
- ("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createURI).
- assertValid("behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_04 {
- this.parser.normalize(
- ("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createURI).
- assertValid("behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_05 {
- this.parser.normalize(
- ("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").
- createURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_06 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID
- + "#frag").createURI).assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_07 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").createURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID,
- SPACE_ID,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_08 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_09 {
- this.parser.normalize(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_10 {
- this.parser.normalize((
- "behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_11 {
- this.parser.normalize(("behavior:/" + BEHAVIOR_ID + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_12 {
- this.parser.normalize(("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_13 {
- this.parser.normalize(("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createURI).
- assertValid("behavior", "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_14 {
- this.parser.normalize(
- ("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createURI).assertValid(
- "behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_15 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createURI).
- assertValid("behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_16 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX
- + "#frag").createURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_17 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "#frag").createURI).assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_18 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").createURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID,
- SPACE_ID,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_19 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_20 {
- this.parser.normalize(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_21 {
- this.parser.normalize((
- "behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_22 {
- this.parser.normalize(("behavior:" + BEHAVIOR_ID + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_23 {
- this.parser.normalize(("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_24 {
- this.parser.normalize(("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createURI).
- assertValid("behavior", "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_25 {
- this.parser.normalize(
- ("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createURI).assertValid(
- "behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_26 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createURI).
- assertValid(
- "behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_27 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "#frag").createURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_28 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "#frag").createURI).assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_29 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").createURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID,
- SPACE_ID,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def normalize_URI_fragment_30 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_31 {
- this.parser.normalize(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").createURI).assertNull
- }
-
- @Test
- def normalize_URI_fragment_32 {
- this.parser.normalize((
- "behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").createURI).assertNull
- }
-
- @Test
- def decode_URI_00 {
- this.parser.decode(("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).assertValid("behavior", -1,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_01 {
- this.parser.decode(("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_02 {
- this.parser.decode(("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).
- assertValid("behavior", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_03 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_04 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_05 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- createNormalizedURI).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_06 {
- this.parser.decode(("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).assertValid("behavior", -1,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_07 {
- this.parser.decode(("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_08 {
- this.parser.decode(("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).
- assertValid("behavior", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_09 {
- this.parser.decode(
- ("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_10 {
- this.parser.decode(
- ("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_11 {
- this.parser.decode(
- ("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- createNormalizedURI).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_12 {
- this.parser.decode(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_13 {
- this.parser.decode(
- ("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "/xxx").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_14 {
- this.parser.decode((
- "behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_15 {
- this.parser.decode(("behavior:" + BEHAVIOR_ID).createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_16 {
- this.parser.decode(("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_17 {
- this.parser.decode(("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).assertValid("behavior", -1,
- AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_18 {
- this.parser.decode(("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).
- assertValid("behavior", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_19 {
- this.parser.decode(("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).
- assertValid("behavior", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_20 {
- this.parser.decode(
- ("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).createNormalizedURI).
- assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_21 {
- this.parser.decode(
- ("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID).createNormalizedURI).
- assertValid("behavior", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_22 {
- this.parser.decode(
- ("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX).
- createNormalizedURI).assertValid("behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_23 {
- this.parser.decode(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_24 {
- this.parser.decode(
- ("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "/xxx").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_25 {
- this.parser.decode((
- "behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX).createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_00 {
- this.parser.decode(("behavior://" + BEHAVIOR_ID + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_01 {
- this.parser.decode(("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_02 {
- this.parser.decode(("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_03 {
- this.parser.decode(
- ("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_04 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_05 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").
- createNormalizedURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_06 {
- this.parser.decode(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_07 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "#frag").createNormalizedURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID,
- SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_08 {
- this.parser.decode(("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_09 {
- this.parser.decode(
- ("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "/xxx#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_10 {
- this.parser.decode((
- "behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_11 {
- this.parser.decode(("behavior:/" + BEHAVIOR_ID + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_12 {
- this.parser.decode(("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_13 {
- this.parser.decode(("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_14 {
- this.parser.decode(
- ("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createNormalizedURI).assertValid(
- "behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_15 {
- this.parser.decode(("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_16 {
- this.parser.decode(("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_17 {
- this.parser.decode(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_18 {
- this.parser.decode(
- ("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_19 {
- this.parser.decode(("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_20 {
- this.parser.decode(
- ("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
- BEHAVIOR_IDX + "/xxx#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_21 {
- this.parser.decode((
- "behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_22 {
- this.parser.decode(("behavior:" + BEHAVIOR_ID + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_23 {
- this.parser.decode(("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_24 {
- this.parser.decode(("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", -1, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_25 {
- this.parser.decode(
- ("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag").createNormalizedURI).assertValid(
- "behavior", "frag", BEHAVIOR_IDX, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_26 {
- this.parser.decode(("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag").createNormalizedURI).
- assertValid("behavior", "frag", -1, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_27 {
- this.parser.decode(("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_28 {
- this.parser.decode(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", -1, CONTEXT_ID, SPACE_ID, AGENT_ID, BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_29 {
- this.parser.decode(
- ("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "#frag").createNormalizedURI).assertValid("behavior", "frag", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID, AGENT_ID,
- BEHAVIOR_ID)
- }
-
- @Test
- def decode_URI_fragment_30 {
- this.parser.decode(("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID +
- "/xxx#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_31 {
- this.parser.decode(
- ("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX +
- "/xxx#frag").createNormalizedURI).assertNull
- }
-
- @Test
- def decode_URI_fragment_32 {
- this.parser.decode((
- "behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" +
- BEHAVIOR_IDX + "#frag").createNormalizedURI).assertNull
- }
-
-}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/AgentNamespaceFinderTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/AgentNamespaceFinderTest.sarl
index 8064c87996..8501e822e8 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/AgentNamespaceFinderTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/AgentNamespaceFinderTest.sarl
@@ -21,12 +21,12 @@
package io.sarl.sre.tests.units.services.namespace
+import io.sarl.api.naming.name.AgentName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.core.OpenEventSpace
import io.sarl.lang.annotation.PrivateAPI
import io.sarl.lang.core.Agent
import io.sarl.sre.capacities.InformedEventListener
-import io.sarl.sre.naming.AgentName
-import io.sarl.sre.naming.NameScheme
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import io.sarl.sre.services.namespace.AgentNamespaceFinder
@@ -47,9 +47,9 @@ import static org.mockito.ArgumentMatchers.*
import static org.mockito.Mockito.*
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertEquals
import static extension org.junit.jupiter.api.Assertions.assertNull
import static extension org.junit.jupiter.api.Assertions.assertSame
+import static extension org.junit.jupiter.api.Assertions.assertEquals
/**
* @author $Author: sgalland$
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/BehaviorNamespaceFinderTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/BehaviorNamespaceFinderTest.sarl
index 6ef4115294..da7d665e53 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/BehaviorNamespaceFinderTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/BehaviorNamespaceFinderTest.sarl
@@ -30,8 +30,6 @@ import io.sarl.lang.core.Behavior
import io.sarl.lang.core.SREutils
import io.sarl.lang.core.Skill
import io.sarl.sre.capacities.InformedEventListener
-import io.sarl.sre.naming.BehaviorName
-import io.sarl.sre.naming.NameScheme
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import io.sarl.sre.services.namespace.BehaviorNamespaceFinder
@@ -59,6 +57,8 @@ import static extension org.junit.jupiter.api.Assertions.assertEquals
import static extension org.junit.jupiter.api.Assertions.assertNull
import static extension org.junit.jupiter.api.Assertions.assertSame
import static extension org.mockito.Mockito.spy
+import io.sarl.api.naming.name.BehaviorName
+import io.sarl.api.naming.scheme.NameScheme
/**
* @author $Author: sgalland$
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ContextNamespaceFinderTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ContextNamespaceFinderTest.sarl
index 52e6eeab0e..af39a0d2bd 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ContextNamespaceFinderTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ContextNamespaceFinderTest.sarl
@@ -22,8 +22,6 @@
package io.sarl.sre.tests.units.services.namespace
import io.sarl.lang.annotation.PrivateAPI
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.naming.NameScheme
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import io.sarl.sre.services.namespace.ContextNamespaceFinder
@@ -45,6 +43,8 @@ import static extension io.sarl.tests.api.tools.TestMockito.mock
import static extension org.junit.jupiter.api.Assertions.assertEquals
import static extension org.junit.jupiter.api.Assertions.assertNull
import static extension org.junit.jupiter.api.Assertions.assertSame
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.scheme.NameScheme
/**
* @author $Author: sgalland$
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ServiceNamespaceFinderTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ServiceNamespaceFinderTest.sarl
index 98cddb90d5..e9cc2ce35c 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ServiceNamespaceFinderTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/ServiceNamespaceFinderTest.sarl
@@ -22,9 +22,9 @@
package io.sarl.sre.tests.units.services.namespace
import com.google.inject.Injector
+import io.sarl.api.naming.name.ServiceName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.annotation.PrivateAPI
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.ServiceName
import io.sarl.sre.services.lifecycle.LifecycleService
import io.sarl.sre.services.logging.LoggingService
import io.sarl.sre.services.namespace.ServiceNamespaceFinder
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SkillNamespaceFinderTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SkillNamespaceFinderTest.sarl
index 0d6bf504f9..b2782f02db 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SkillNamespaceFinderTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SkillNamespaceFinderTest.sarl
@@ -21,14 +21,14 @@
package io.sarl.sre.tests.units.services.namespace
+import io.sarl.api.naming.name.SkillName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.core.OpenEventSpace
import io.sarl.lang.annotation.PrivateAPI
import io.sarl.lang.core.Agent
import io.sarl.lang.core.Capacity
import io.sarl.lang.core.Skill
import io.sarl.sre.capacities.InformedEventListener
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SkillName
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import io.sarl.sre.services.namespace.SkillNamespaceFinder
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SpaceNamespaceFinderTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SpaceNamespaceFinderTest.sarl
index f7b78fc2b3..d525feee6d 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SpaceNamespaceFinderTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/SpaceNamespaceFinderTest.sarl
@@ -21,10 +21,10 @@
package io.sarl.sre.tests.units.services.namespace
+import io.sarl.api.naming.name.SpaceName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.core.OpenEventSpace
import io.sarl.lang.annotation.PrivateAPI
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SpaceName
import io.sarl.sre.services.context.Context
import io.sarl.sre.services.context.ContextService
import io.sarl.sre.services.namespace.SpaceNamespaceFinder
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/AsynchronousProbeServiceTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/AsynchronousProbeServiceTest.sarl
index 2e28c7c8fa..c5f1f367fb 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/AsynchronousProbeServiceTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/AsynchronousProbeServiceTest.sarl
@@ -21,15 +21,14 @@
package io.sarl.sre.tests.units.services.probing
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.sre.internal.SequenceListenerNotifier
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SarlName
import io.sarl.sre.services.executor.ExecutorService
-import io.sarl.sre.services.namespace.FieldAccess
-import io.sarl.sre.services.namespace.NamespaceService
import io.sarl.sre.services.probing.AsynchronousProbeService
import io.sarl.sre.services.probing.Probe
import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
@@ -57,6 +56,7 @@ import static extension org.mockito.ArgumentMatchers.any
import static extension org.mockito.Mockito.spy
import static extension org.mockito.Mockito.times
import static extension org.mockito.Mockito.verify
+import io.sarl.api.naming.namespace.NamespaceService
/**
* @author $Author: sgalland$
@@ -82,7 +82,7 @@ class AsynchronousProbeServiceTest {
var namespaceService : NamespaceService
@Nullable
- var nameParser : NameParser
+ var nameParser : UriBasedNameParser
@Nullable
var executorService : ExecutorService
@@ -107,7 +107,7 @@ class AsynchronousProbeServiceTest {
when(this.fieldAccess.name).thenReturn(this.nameObject)
this.namespaceService = typeof(NamespaceService).mock
when(this.namespaceService.findObject(typeof(SarlName).any)).thenReturn(this.fieldAccess)
- this.nameParser = typeof(NameParser).mock
+ this.nameParser = typeof(UriBasedNameParser).mock
when(this.nameParser.normalize(any(typeof(URI)))).thenAnswer[it.getArgument(0)]
when(this.nameParser.decode(any(typeof(URI)))).thenAnswer [
if (it.getArgument(0) === this.uri0) {
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/FieldProbeTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/FieldProbeTest.sarl
index 53fe1c8064..944b832e4c 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/FieldProbeTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/FieldProbeTest.sarl
@@ -21,11 +21,11 @@
package io.sarl.sre.tests.units.services.probing
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.sre.internal.SequenceListenerNotifier
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.services.namespace.FieldAccess
import io.sarl.sre.services.probing.FieldProbe
import io.sarl.sre.services.probing.IProbeListener
import io.sarl.sre.services.probing.IProbeReleaseListener
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/SynchronousProbeServiceTest.sarl b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/SynchronousProbeServiceTest.sarl
index 4cf66ec3a7..fd15229dfe 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/SynchronousProbeServiceTest.sarl
+++ b/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/probing/SynchronousProbeServiceTest.sarl
@@ -21,14 +21,13 @@
package io.sarl.sre.tests.units.services.probing
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.sre.internal.SequenceListenerNotifier
import io.sarl.sre.internal.SmartListenerCollection
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.services.namespace.FieldAccess
-import io.sarl.sre.services.namespace.NamespaceService
import io.sarl.sre.services.probing.Probe
import io.sarl.sre.services.probing.SynchronousProbeService
import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
@@ -56,6 +55,7 @@ import static extension org.mockito.ArgumentMatchers.any
import static extension org.mockito.Mockito.spy
import static extension org.mockito.Mockito.times
import static extension org.mockito.Mockito.verify
+import io.sarl.api.naming.namespace.NamespaceService
/**
* @author $Author: sgalland$
@@ -81,7 +81,7 @@ class SynchronousProbeServiceTest {
var namespaceService : NamespaceService
@Nullable
- var nameParser : NameParser
+ var nameParser : UriBasedNameParser
@Nullable
var service : SynchronousProbeService
@@ -103,7 +103,7 @@ class SynchronousProbeServiceTest {
when(this.fieldAccess.name).thenReturn(this.nameObject)
this.namespaceService = typeof(NamespaceService).mock
when(this.namespaceService.findObject(typeof(SarlName).any)).thenReturn(this.fieldAccess)
- this.nameParser = typeof(NameParser).mock
+ this.nameParser = typeof(UriBasedNameParser).mock
when(this.nameParser.normalize(any(typeof(URI)))).thenAnswer[it.getArgument(0) as URI]
when(this.nameParser.decode(any(typeof(URI)))).thenAnswer[
if (it.getArgument(0) === this.uri0) {
diff --git a/tests/io.sarl.api.naming.tests/pom.xml b/tests/io.sarl.api.naming.tests/pom.xml
new file mode 100644
index 0000000000..dd76ff9747
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/pom.xml
@@ -0,0 +1,75 @@
+
+ 4.0.0
+
+
+ io.sarl
+ io.sarl.tests
+ 0.12.0-SNAPSHOT
+
+
+ io.sarl.api.naming.tests
+
+ Naming API Tests
+
+
+
+ io.sarl.lang
+ io.sarl.lang.core
+
+
+ io.sarl
+ io.sarl.tests.api
+ test
+
+
+ io.sarl
+ io.sarl.api.naming
+ test
+
+
+
+
+
+
+ io.sarl.maven
+ sarl-maven-plugin
+
+
+
+ sarl-compiler-init
+ initialize
+
+ initialize
+
+
+
+ sarl-compiler-testCompile
+ test-compile
+
+ testCompile
+
+
+
+ sarl-compiler-clean
+ clean
+
+ clean
+
+
+
+
+ ${sarl-dsl.min.jdk.version}
+ ${sarl-dsl.min.jdk.version}
+ ${project.build.sourceEncoding}
+ true
+ true
+ true
+ true
+
+
+
+
+
+
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/BehaviorMock.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/BehaviorMock.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/BehaviorMock.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/BehaviorMock.sarl
index 03afd10166..a888cc567b 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/BehaviorMock.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/BehaviorMock.sarl
@@ -19,7 +19,7 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming.mocks
+package io.sarl.api.naming.tests.mocks
import io.sarl.lang.core.Behavior
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/CapacityMock.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/CapacityMock.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/CapacityMock.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/CapacityMock.sarl
index 55808727e4..a8e48dc76e 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/CapacityMock.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/CapacityMock.sarl
@@ -19,7 +19,7 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming.mocks
+package io.sarl.api.naming.tests.mocks
import io.sarl.lang.core.Capacity
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/ContextMock.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/ContextMock.sarl
new file mode 100644
index 0000000000..455457fb3c
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/ContextMock.sarl
@@ -0,0 +1,34 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.mocks
+
+import io.sarl.lang.core.AgentContext
+
+/**
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+interface ContextMock extends AgentContext {
+ //
+}
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/ServiceMock.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/ServiceMock.sarl
new file mode 100644
index 0000000000..9a2c89f869
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/ServiceMock.sarl
@@ -0,0 +1,34 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.mocks
+
+import com.google.common.util.concurrent.Service
+
+/**
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+interface ServiceMock extends Service {
+ //
+}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/SkillMock.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/SkillMock.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/SkillMock.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/SkillMock.sarl
index fe0038c299..28e7135d96 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/mocks/SkillMock.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/mocks/SkillMock.sarl
@@ -19,7 +19,7 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming.mocks
+package io.sarl.api.naming.tests.mocks
import io.sarl.lang.core.Skill
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/AgentNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/AgentNameTest.sarl
similarity index 83%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/AgentNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/AgentNameTest.sarl
index 571f2625e4..839206e18e 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/AgentNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/AgentNameTest.sarl
@@ -19,11 +19,10 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
+import io.sarl.api.naming.name.AgentName
import io.sarl.lang.core.Agent
-import io.sarl.sre.naming.AgentName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.net.URI
@@ -36,9 +35,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
/**
* @author $Author: sgalland$
@@ -48,13 +46,12 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: AgentName test")
+@DisplayName("AgentName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class AgentNameTest {
@Nullable
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/BehaviorNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/BehaviorNameTest.sarl
similarity index 82%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/BehaviorNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/BehaviorNameTest.sarl
index 5e8b67b4da..6c902ab75e 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/BehaviorNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/BehaviorNameTest.sarl
@@ -19,12 +19,11 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
+import io.sarl.api.naming.tests.mocks.BehaviorMock
+import io.sarl.api.naming.name.BehaviorName
import io.sarl.lang.core.Behavior
-import io.sarl.sre.naming.BehaviorName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
-import io.sarl.sre.tests.units.naming.mocks.BehaviorMock
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.net.URI
@@ -38,9 +37,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
/**
* @author $Author: sgalland$
@@ -50,13 +48,12 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: BehaviorName test")
+@DisplayName("BehaviorName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class SkillNameTest {
@Nullable
@@ -87,7 +84,7 @@ class SkillNameTest {
this.agentId = UUID::randomUUID
this.^behaviorType = typeof(BehaviorMock)
this.behaviorIndex = new Random().nextInt
- this.name = (new BehaviorName(this.uri, this.contextId, this.spaceId, this.agentId, this.^behaviorType,
+ this.name = (new BehaviorName(this.uri, this.contextId, this.spaceId, this.agentId, this.behaviorType,
this.behaviorIndex) {
}).spy
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ContextNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/ContextNameTest.sarl
similarity index 78%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ContextNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/ContextNameTest.sarl
index 59c510aeae..52394bacf2 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ContextNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/ContextNameTest.sarl
@@ -19,11 +19,10 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.services.context.Context
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.tests.mocks.ContextMock
+import io.sarl.api.naming.name.ContextName
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.net.URI
@@ -36,9 +35,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
/**
* @author $Author: sgalland$
@@ -48,13 +46,12 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: ContextName test")
+@DisplayName("ContextName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class ContextNameTest {
@Nullable
@@ -87,7 +84,7 @@ class ContextNameTest {
@Test
def setAssociatedContext {
- var ctx = typeof(Context).mock
+ var ctx = typeof(ContextMock).mock
this.name.associatedObject = ctx
var ref = this.name.associatedObject
ctx.assertSame(ref)
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SarlNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SarlNameTest.sarl
similarity index 75%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SarlNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SarlNameTest.sarl
index 8be55e9d17..bc6458e037 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SarlNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SarlNameTest.sarl
@@ -19,11 +19,10 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -34,12 +33,10 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
-import static extension io.sarl.tests.api.tools.TestAssertions.assertStrictlyNegative
-import static extension io.sarl.tests.api.tools.TestAssertions.assertStrictlyPositive
-import static extension io.sarl.tests.api.tools.TestAssertions.assertZero
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.junit.jupiter.api.Assertions.assertTrue
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
+import static extension io.sarl.tests.api.tools.TestAssertions.*
+
/**
* @author $Author: sgalland$
@@ -49,13 +46,12 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: SarlName test")
+@DisplayName("SarlName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class SarlNameTest {
@Nullable
@@ -115,4 +111,4 @@ class SarlNameTest {
NameScheme::SPACE.assertSame(this.name.scheme)
}
-}
\ No newline at end of file
+}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ServiceNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/ServiceNameTest.sarl
similarity index 77%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ServiceNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/ServiceNameTest.sarl
index fae4b746e9..cb4d6d012a 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ServiceNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/ServiceNameTest.sarl
@@ -19,12 +19,11 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
import com.google.common.util.concurrent.Service
-import io.sarl.sre.naming.ServiceName
-import io.sarl.sre.services.logging.LoggingService
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.tests.mocks.ServiceMock
+import io.sarl.api.naming.name.ServiceName
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.net.URI
@@ -36,9 +35,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
/**
* @author $Author: sgalland$
@@ -48,14 +46,13 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: ContextName test")
+@DisplayName("ServiceName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
-class ContextNameTest {
+@Tag("api")
+@Tag("api-naming")
+class ServiceNameTest {
@Nullable
var uri : URI
@@ -69,7 +66,7 @@ class ContextNameTest {
@BeforeEach
def setUp : void {
this.uri = URI::create("http://www.sarl.io/001#fragment")
- this.serviceType = typeof(LoggingService)
+ this.serviceType = typeof(ServiceMock)
this.name = (new ServiceName(this.uri, this.serviceType) {
}).spy
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SkillNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SkillNameTest.sarl
similarity index 81%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SkillNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SkillNameTest.sarl
index 2f86e081eb..e810a35d35 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SkillNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SkillNameTest.sarl
@@ -19,13 +19,12 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
+import io.sarl.api.naming.tests.mocks.CapacityMock
+import io.sarl.api.naming.tests.mocks.SkillMock
+import io.sarl.api.naming.name.SkillName
import io.sarl.lang.core.Capacity
-import io.sarl.sre.naming.SkillName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
-import io.sarl.sre.tests.units.naming.mocks.CapacityMock
-import io.sarl.sre.tests.units.naming.mocks.SkillMock
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.net.URI
@@ -38,9 +37,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
/**
* @author $Author: sgalland$
@@ -50,13 +48,12 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: SkillName test")
+@DisplayName("SkillName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class SkillNameTest {
@Nullable
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SpaceNameTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SpaceNameTest.sarl
similarity index 82%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SpaceNameTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SpaceNameTest.sarl
index 4789ebfa22..5f26e8a076 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SpaceNameTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/name/SpaceNameTest.sarl
@@ -19,11 +19,10 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.name
+import io.sarl.api.naming.name.SpaceName
import io.sarl.lang.core.Space
-import io.sarl.sre.naming.SpaceName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.net.URI
@@ -36,9 +35,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestMockito.mock
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import static extension org.junit.jupiter.api.Assertions.*
+import static extension org.mockito.Mockito.*
/**
* @author $Author: sgalland$
@@ -48,13 +46,12 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: SpaceName test")
+@DisplayName("SpaceName")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class SpaceNameTest {
@Nullable
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/FieldAccessTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/FieldAccessTest.sarl
similarity index 88%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/FieldAccessTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/FieldAccessTest.sarl
index 83b13be194..1179657e12 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/FieldAccessTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/FieldAccessTest.sarl
@@ -19,11 +19,10 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.services.namespace
+package io.sarl.api.naming.tests.namespace
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.services.namespace.FieldAccess
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.namespace.FieldAccess
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.lang.reflect.Field
@@ -47,13 +46,12 @@ import static extension org.junit.jupiter.api.Assertions.assertSame
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: FieldAccess test")
+@DisplayName("FieldAccess")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class FieldAccessTest {
private static class ObjectMock {
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/FinderBasedNamespaceServiceTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/FinderBasedNamespaceServiceTest.sarl
similarity index 79%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/FinderBasedNamespaceServiceTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/FinderBasedNamespaceServiceTest.sarl
index b6c5de7f7a..a40f2ec26d 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/services/namespace/FinderBasedNamespaceServiceTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/FinderBasedNamespaceServiceTest.sarl
@@ -19,31 +19,26 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.services.namespace
-
+package io.sarl.api.naming.tests.namespace
+
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.name.SpaceName
+import io.sarl.api.naming.namespace.FieldAccess
+import io.sarl.api.naming.namespace.FinderBasedNamespaceService
+import io.sarl.api.naming.namespace.INamespaceFinder
+import io.sarl.api.naming.parser.ContextSchemeNameParser
+import io.sarl.api.naming.parser.INameParser
+import io.sarl.api.naming.parser.ISchemeNameParser
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.scheme.NameScheme
import io.sarl.lang.annotation.PrivateAPI
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.naming.ContextSchemeNameParser
-import io.sarl.sre.naming.INameParser
-import io.sarl.sre.naming.ISchemeNameParser
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.naming.SpaceName
-import io.sarl.sre.services.context.Context
-import io.sarl.sre.services.context.ContextService
-import io.sarl.sre.services.context.SpaceRepository
-import io.sarl.sre.services.context.SpaceRepositoryListenerFactory
-import io.sarl.sre.services.logging.LoggingService
-import io.sarl.sre.services.namespace.ContextNamespaceFinder
-import io.sarl.sre.services.namespace.FieldAccess
-import io.sarl.sre.services.namespace.FinderBasedNamespaceService
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.lang.core.AgentContext
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import java.util.Collections
import java.util.UUID
-import javax.inject.Provider
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag
@@ -51,15 +46,15 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static io.sarl.tests.api.tools.TestAssertions.*
-import static org.mockito.ArgumentMatchers.*
import static org.mockito.Mockito.*
import static extension io.sarl.tests.api.tools.TestMockito.mock
+import static extension org.mockito.Mockito.spy
import static extension org.junit.jupiter.api.Assertions.assertEquals
import static extension org.junit.jupiter.api.Assertions.assertNotNull
import static extension org.junit.jupiter.api.Assertions.assertNull
import static extension org.junit.jupiter.api.Assertions.assertSame
-import static extension org.mockito.Mockito.spy
+import io.sarl.api.naming.tests.namespace.mocks.MyContext
/**
* @author $Author: sgalland$
@@ -69,81 +64,61 @@ import static extension org.mockito.Mockito.spy
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: FinderBasedNamespaceService test")
+@DisplayName("FinderBasedNamespaceService")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class FinderBasedNamespaceServiceTest {
@Nullable
var service : FinderBasedNamespaceService
@Nullable
- var contextService : ContextService
-
- @Nullable
- var finder : ContextNamespaceFinder
-
- @Nullable
- var nameParser : NameParser
+ var nameParser : UriBasedNameParser
@SuppressWarnings("raw_type")
@Nullable
var schemeParser : ISchemeNameParser
@Nullable
- var cid0 : UUID
-
- @Nullable
- var ctx0 : Context
+ var finder : INamespaceFinder
@Nullable
- var cid1 : UUID
+ var cid0 : UUID
@Nullable
- var ctx1 : Context
+ var ctx0 : AgentContext
@SuppressWarnings("raw_type", "use_reserved_sarl_annotation")
@BeforeEach
@PrivateAPI(isCallerOnly = true)
def setUp : void {
- this.contextService = typeof(ContextService).mock
+ // Default space creation
+ this.cid0 = UUID::randomUUID
+ this.ctx0 = new MyContext().spy
+
this.schemeParser = new ContextSchemeNameParser
- this.finder = new ContextNamespaceFinder(this.contextService)
- this.service = new FinderBasedNamespaceService
- this.nameParser = new NameParser
- this.nameParser.schemeNameParsers = Collections::singleton(this.schemeParser)
- this.service.nameParser = this.nameParser
- this.service.namespaceFinders = Collections::singleton(this.finder)
- var spaceRepository = typeof(SpaceRepository).mock
-
- var logger = typeof(LoggingService).mock
-
- var listenerFactory = typeof(SpaceRepositoryListenerFactory).mock
-
+ this.nameParser = new UriBasedNameParser
+ this.nameParser.schemeNameParsers = Collections::singleton(this.schemeParser)
- // Default space creation
- this.cid0 = UUID::randomUUID
- this.ctx0 = new MyContext([spaceRepository], logger, listenerFactory).spy
-
- // Other space creation
- this.cid1 = UUID::randomUUID
- this.ctx1 = new MyContext([spaceRepository], logger, listenerFactory).spy
-
- when(this.contextService.rootContext).thenReturn(this.ctx0)
- when(this.contextService.getContext(any(typeof(UUID)))).thenAnswer [
- if (it.getArgument(0) == this.cid0) {
- return this.ctx0
- } else if (it.getArgument(0) == this.cid1) {
- return this.ctx1
- } else {
- return null
+ this.finder = typeof(INamespaceFinder).mock
+ when(this.finder.scheme).thenReturn(NameScheme::CONTEXT)
+ when(this.finder.find(any)).thenAnswer [
+ val name : SarlName = it.getArgument(0)
+ if (name instanceof ContextName) {
+ if (name.contextId == this.cid0) {
+ return this.ctx0
+ }
}
+ return null
]
+
+ this.service = new FinderBasedNamespaceService
+ this.service.nameParser = this.nameParser
+ this.service.namespaceFinders = Collections::singleton(this.finder)
}
@Test
@@ -258,7 +233,7 @@ class FinderBasedNamespaceServiceTest {
@Test
def findObject_String_Class_00_Context : void {
- this.ctx0.assertSame(this.service.findObject("context:" + this.cid0.toString, typeof(Context)))
+ this.ctx0.assertSame(this.service.findObject("context:" + this.cid0.toString, typeof(AgentContext)))
}
@Test
@@ -276,7 +251,7 @@ class FinderBasedNamespaceServiceTest {
var name = typeof(ContextName).mock
when(name.scheme).thenReturn(NameScheme::CONTEXT)
when(name.contextId).thenReturn(this.cid0)
- this.ctx0.assertSame(this.service.findObject(name, typeof(Context)))
+ this.ctx0.assertSame(this.service.findObject(name, typeof(AgentContext)))
}
@Test
@@ -302,7 +277,7 @@ class FinderBasedNamespaceServiceTest {
when(name.contextId).thenReturn(this.cid0)
when(name.fragment).thenReturn("myfield")
when(name.hasFragment).thenReturn(true)
- this.service.findObject(name, typeof(Context)).assertNull
+ this.service.findObject(name, typeof(AgentContext)).assertNull
}
@Test
@@ -352,7 +327,7 @@ class FinderBasedNamespaceServiceTest {
when(name.contextId).thenReturn(this.cid0)
when(name.fragment).thenReturn("xyz")
when(name.hasFragment).thenReturn(true)
- this.service.findObject(name, typeof(Context)).assertNull
+ this.service.findObject(name, typeof(AgentContext)).assertNull
}
@Test
@@ -389,7 +364,7 @@ class FinderBasedNamespaceServiceTest {
def findObject_SarlName_Class_03_Context : void {
var name = typeof(SpaceName).mock
when(name.scheme).thenReturn(NameScheme::SPACE)
- this.service.findObject(name, typeof(Context)).assertNull
+ this.service.findObject(name, typeof(AgentContext)).assertNull
}
@Test
@@ -412,17 +387,5 @@ class FinderBasedNamespaceServiceTest {
when(name.scheme).thenReturn(NameScheme::SPACE)
this.service.findObject(name, typeof(Integer)).assertNull
}
-
- private static class MyContext extends Context {
-
- @SuppressWarnings("unused_private_member")
- var myfield : int = 34
-
- new(spaceRepositoryProvider : Provider, logger : LoggingService,
- listenerFactory : SpaceRepositoryListenerFactory) {
- super(null, null, null, spaceRepositoryProvider, logger, listenerFactory)
- }
-
- }
}
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/mocks/MyContext.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/mocks/MyContext.sarl
new file mode 100644
index 0000000000..197e85ed68
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/namespace/mocks/MyContext.sarl
@@ -0,0 +1,75 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.namespace.mocks
+
+import io.sarl.lang.core.AgentContext
+import io.sarl.lang.core.EventSpace
+import io.sarl.lang.core.Space
+import io.sarl.lang.core.SpaceSpecification
+import java.util.UUID
+import java.util.concurrent.ConcurrentLinkedDeque
+
+/** Mock of an agent context.
+ *
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+class MyContext implements AgentContext {
+
+ @SuppressWarnings("unused_private_member")
+ val myfield : int = 34
+
+ def createSpace(spec : Class extends SpaceSpecification>, spaceUUID : UUID, creationParams : Object*) : S with S extends Space {
+ throw new UnsupportedOperationException
+ }
+
+ def getDefaultSpace : EventSpace {
+ throw new UnsupportedOperationException
+ }
+
+ def getID : UUID {
+ throw new UnsupportedOperationException
+ }
+
+ def getOrCreateSpaceWithID(spec : Class extends SpaceSpecification>, spaceUUID : UUID, creationParams : Object*) : S with S extends Space {
+ throw new UnsupportedOperationException
+ }
+
+ def getOrCreateSpaceWithSpec(spec : Class extends SpaceSpecification>, spaceUUID : UUID, creationParams : Object*) : S with S extends Space {
+ throw new UnsupportedOperationException
+ }
+
+ def getSpace(spaceUUID : UUID) : S with S extends Space {
+ throw new UnsupportedOperationException
+ }
+
+ def getSpaces : ConcurrentLinkedDeque extends Space> {
+ throw new UnsupportedOperationException
+ }
+
+ def getSpaces(spec : Class extends SpaceSpecification>) : ConcurrentLinkedDeque with S extends Space {
+ throw new UnsupportedOperationException
+ }
+
+}
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AbstractBehaviorSchemeNameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AbstractBehaviorSchemeNameParserTest.sarl
new file mode 100644
index 0000000000..16ef13d3ac
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AbstractBehaviorSchemeNameParserTest.sarl
@@ -0,0 +1,157 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.parser
+
+import io.sarl.api.naming.name.BehaviorName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.parser.BehaviorSchemeNameParser
+import io.sarl.api.naming.tests.mocks.BehaviorMock
+import io.sarl.tests.api.Nullable
+import io.sarl.tests.api.extensions.ContextInitExtension
+import io.sarl.tests.api.extensions.JavaVersionCheckExtension
+import java.net.URI
+import java.util.UUID
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Tag
+import org.junit.jupiter.api.^extension.ExtendWith
+
+import static extension io.sarl.tests.api.tools.TestAssertions.assertNullOrEmpty
+import static extension org.junit.jupiter.api.Assertions.assertEquals
+import static extension org.junit.jupiter.api.Assertions.assertNotNull
+import static extension org.junit.jupiter.api.Assertions.assertNull
+import io.sarl.api.naming.parser.UriBasedNameParser
+
+/**
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+@ExtendWith(#[
+ typeof(ContextInitExtension),
+ typeof(JavaVersionCheckExtension)
+])
+@Tag("unit")
+@Tag("api")
+@Tag("api-naming")
+abstract class AbstractBehaviorSchemeNameParserTest {
+
+ protected static val CONTEXT_ID = "2a2c6de4-8327-431b-a916-97a05caafe14"
+
+ protected static val SPACE_ID = "bb0d92be-1730-4453-a284-bd66d31b853f"
+
+ protected static val AGENT_ID = "a0875b30-cff3-4461-9b96-f501e6c6a788"
+
+ protected static val BEHAVIOR_ID = typeof(BehaviorMock).name
+
+ protected static val BEHAVIOR_IDX = 8
+
+ @Nullable
+ protected var parser : UriBasedNameParser
+
+ private static def m(index : int, e : String*) : String {
+ val b = new StringBuilder
+ for (elt : e) {
+ if (!elt.isNullOrEmpty) {
+ b.append("/").append(elt)
+ }
+ }
+ if (index >= 0) {
+ b.append("/").append(index)
+ }
+ return b.toString
+ }
+
+ protected static def assertValid(uri : URI, s : String, fragment : String = null, kindex : int,
+ elements : String*) : void {
+ uri.assertNotNull
+ s.assertEquals(uri.scheme)
+ m(kindex, elements).assertEquals(uri.path)
+ if (fragment.isNullOrEmpty) {
+ uri.fragment.assertNullOrEmpty
+ } else {
+ fragment.assertEquals(uri.fragment)
+ }
+ uri.host.assertNullOrEmpty
+ uri.port.assertEquals(-1)
+ uri.query.assertNullOrEmpty
+ uri.userInfo.assertNullOrEmpty
+ }
+
+ protected static def assertValid(name : SarlName, s : String, fragment : String = null, kindex : int, elements : String*) : void {
+ name.assertNotNull
+ name.toURI.assertValid(s, fragment, kindex, elements)
+ if (fragment.isNullOrEmpty) {
+ name.fragment.assertNullOrEmpty
+ } else {
+ fragment.assertEquals(name.fragment)
+ }
+ val n = name as BehaviorName
+ if (n.contextId === null) {
+ n.contextId.assertNull
+ n.spaceId.assertNull
+ elements.get(0).toUUID.assertEquals(n.agentId)
+ elements.get(1).assertEquals(n.behaviorType.name)
+ if (elements.length != 2) {
+ 3.assertEquals(elements.length)
+ elements.get(2).assertEquals(BEHAVIOR_IDX)
+ }
+ } else if (n.spaceId === null) {
+ elements.get(0).toUUID.assertEquals(n.contextId)
+ n.spaceId.assertNull
+ elements.get(1).toUUID.assertEquals(n.agentId)
+ elements.get(2).assertEquals(n.behaviorType.name)
+ if (elements.length != 3) {
+ 4.assertEquals(elements.length)
+ elements.get(3).assertEquals(BEHAVIOR_IDX)
+ }
+ } else {
+ elements.get(0).toUUID.assertEquals(n.contextId)
+ elements.get(1).toUUID.assertEquals(n.spaceId)
+ elements.get(2).toUUID.assertEquals(n.agentId)
+ elements.get(3).assertEquals(n.behaviorType.name)
+ if (elements.length != 4) {
+ 5.assertEquals(elements.length)
+ elements.get(4).assertEquals(BEHAVIOR_IDX)
+ }
+ }
+ }
+
+ private static def toUUID(s : String) : UUID {
+ UUID::fromString(s)
+ }
+
+ protected static def createURI(value : String) : URI {
+ URI::create(value)
+ }
+
+ protected def createNormalizedURI(value : String) : URI {
+ this.parser.normalize(value.createURI)
+ }
+
+ @BeforeEach
+ def setUp : void {
+ this.parser = new UriBasedNameParser()
+ this.parser.addSchemeNameParser(new BehaviorSchemeNameParser)
+ }
+
+}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/NameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AbstractNameParserTest.sarl
similarity index 79%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/NameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AbstractNameParserTest.sarl
index e16165c26a..a66002692c 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/NameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AbstractNameParserTest.sarl
@@ -19,16 +19,14 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
-
-import io.sarl.sre.naming.AgentSchemeNameParser
-import io.sarl.sre.naming.BehaviorSchemeNameParser
-import io.sarl.sre.naming.ContextSchemeNameParser
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.ServiceSchemeNameParser
-import io.sarl.sre.naming.SkillSchemeNameParser
-import io.sarl.sre.naming.SpaceSchemeNameParser
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+package io.sarl.api.naming.tests.parser
+
+import io.sarl.api.naming.parser.AgentSchemeNameParser
+import io.sarl.api.naming.parser.BehaviorSchemeNameParser
+import io.sarl.api.naming.parser.ContextSchemeNameParser
+import io.sarl.api.naming.parser.ServiceSchemeNameParser
+import io.sarl.api.naming.parser.SkillSchemeNameParser
+import io.sarl.api.naming.parser.SpaceSchemeNameParser
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -40,7 +38,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension java.net.URI.create
-import static extension org.junit.jupiter.api.Assertions.assertNull
+import static extension org.junit.jupiter.api.Assertions.*
+import io.sarl.api.naming.parser.UriBasedNameParser
/**
* @author $Author: sgalland$
@@ -50,21 +49,20 @@ import static extension org.junit.jupiter.api.Assertions.assertNull
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: base NameParser test")
+@DisplayName("URI-based NameParser")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class NameParserTest {
@Nullable
- var parser : NameParser
+ var parser : UriBasedNameParser
@BeforeEach
def setUp : void {
- this.parser = new NameParser
+ this.parser = new UriBasedNameParser()
this.parser.addSchemeNameParser(new ServiceSchemeNameParser)
this.parser.addSchemeNameParser(new ContextSchemeNameParser)
this.parser.addSchemeNameParser(new SpaceSchemeNameParser)
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/AgentSchemeNameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AgentSchemeNameParserTest.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/AgentSchemeNameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AgentSchemeNameParserTest.sarl
index 21294b6033..8968fb4e0b 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/AgentSchemeNameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/AgentSchemeNameParserTest.sarl
@@ -19,13 +19,11 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.parser
-import io.sarl.sre.naming.AgentName
-import io.sarl.sre.naming.AgentSchemeNameParser
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.name.AgentName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.parser.AgentSchemeNameParser
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -38,9 +36,8 @@ import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
import static extension io.sarl.tests.api.tools.TestAssertions.assertNullOrEmpty
-import static extension org.junit.jupiter.api.Assertions.assertEquals
-import static extension org.junit.jupiter.api.Assertions.assertNotNull
-import static extension org.junit.jupiter.api.Assertions.assertNull
+import static extension org.junit.jupiter.api.Assertions.*
+import io.sarl.api.naming.parser.UriBasedNameParser
/**
* @author $Author: sgalland$
@@ -50,13 +47,12 @@ import static extension org.junit.jupiter.api.Assertions.assertNull
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: agent NameParser test")
+@DisplayName("Agent NameParser")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class AgentSchemeNameParserTest {
protected static val CONTEXT_ID = "2a2c6de4-8327-431b-a916-97a05caafe14"
@@ -66,11 +62,11 @@ class AgentSchemeNameParserTest {
protected static val AGENT_ID = "a0875b30-cff3-4461-9b96-f501e6c6a788"
@Nullable
- var parser : NameParser
+ var parser : UriBasedNameParser
@BeforeEach
def setUp : void {
- this.parser = new NameParser
+ this.parser = new UriBasedNameParser()
this.parser.addSchemeNameParser(new AgentSchemeNameParser)
}
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserDecodeStringTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserDecodeStringTest.sarl
new file mode 100644
index 0000000000..8487bcf4c1
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserDecodeStringTest.sarl
@@ -0,0 +1,222 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.parser
+
+import java.util.stream.Stream
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.params.ParameterizedTest
+import org.junit.jupiter.params.provider.Arguments
+import org.junit.jupiter.params.provider.MethodSource
+
+import static extension org.junit.jupiter.api.Assertions.assertNull
+
+/**
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+@DisplayName("Behavior NameParser decode(String)")
+class BehaviorSchemeNameParserDecodeStringTest extends AbstractBehaviorSchemeNameParserTest {
+
+ @ParameterizedTest
+ @MethodSource
+ @DisplayName("decode(String)")
+ def decode_String(source : String,
+ expectedScheme : String, expectedIndex : int, expectedContext : String, expectedSpace : String) {
+ val actual = this.parser.decode(source)
+ if (expectedScheme === null) {
+ actual.assertNull
+ } else if (expectedContext === null) {
+ actual.assertValid(expectedScheme, expectedIndex, AGENT_ID, BEHAVIOR_ID)
+ } else if (expectedSpace === null) {
+ actual.assertValid(expectedScheme, expectedIndex, expectedContext, AGENT_ID, BEHAVIOR_ID)
+ } else {
+ actual.assertValid(expectedScheme, expectedIndex, expectedContext, expectedSpace, AGENT_ID, BEHAVIOR_ID)
+ }
+ }
+
+ @SuppressWarnings("unused_private_member")
+ private static def decode_String : Stream {
+ Stream::of(
+ Arguments::of("behavior:",
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" +
+ BEHAVIOR_IDX, "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null)
+ )
+ }
+
+ @ParameterizedTest
+ @MethodSource
+ @DisplayName("decode(String+Fragment)")
+ def decode_StringFragment(source : String, expectedScheme : String, expectedIndex : int, expectedContext : String, expectedSpace : String) {
+ val actual = this.parser.decode(source)
+ if (expectedScheme === null) {
+ actual.assertNull
+ } else if (expectedContext === null) {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, AGENT_ID, BEHAVIOR_ID)
+ } else if (expectedSpace === null) {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, expectedContext, AGENT_ID, BEHAVIOR_ID)
+ } else {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, expectedContext, expectedSpace, AGENT_ID, BEHAVIOR_ID)
+ }
+ }
+
+ @SuppressWarnings("unused_private_member")
+ private static def decode_StringFragment : Stream {
+ Stream::of(
+ Arguments::of("behavior:#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null)
+ )
+ }
+
+}
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserDecodeURITest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserDecodeURITest.sarl
new file mode 100644
index 0000000000..0ac538317c
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserDecodeURITest.sarl
@@ -0,0 +1,212 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.parser
+
+import java.util.stream.Stream
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.params.ParameterizedTest
+import org.junit.jupiter.params.provider.Arguments
+import org.junit.jupiter.params.provider.MethodSource
+
+import static extension org.junit.jupiter.api.Assertions.assertNull
+
+/**
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+@DisplayName("Behavior NameParser decode(URI)")
+class BehaviorSchemeNameParserDecodeURITest extends AbstractBehaviorSchemeNameParserTest {
+
+ @ParameterizedTest
+ @MethodSource
+ @DisplayName("decode(URI)")
+ def decode_URI(source : String,
+ expectedScheme : String, expectedIndex : int, expectedContext : String, expectedSpace : String) {
+ val actual = this.parser.decode(source.createNormalizedURI)
+ if (expectedScheme === null) {
+ actual.assertNull
+ } else if (expectedContext === null) {
+ actual.assertValid(expectedScheme, expectedIndex, AGENT_ID, BEHAVIOR_ID)
+ } else if (expectedSpace === null) {
+ actual.assertValid(expectedScheme, expectedIndex, expectedContext, AGENT_ID, BEHAVIOR_ID)
+ } else {
+ actual.assertValid(expectedScheme, expectedIndex, expectedContext, expectedSpace, AGENT_ID, BEHAVIOR_ID)
+ }
+ }
+
+ @SuppressWarnings("unused_private_member")
+ private static def decode_URI : Stream {
+ Stream::of(
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null)
+ )
+ }
+
+ @ParameterizedTest
+ @MethodSource
+ @DisplayName("decode(URI+Fragment)")
+ def decode_URIFragment(source : String, expectedScheme : String, expectedIndex : int, expectedContext : String, expectedSpace : String) {
+ val actual = this.parser.decode(source.createNormalizedURI)
+ if (expectedScheme === null) {
+ actual.assertNull
+ } else if (expectedContext === null) {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, AGENT_ID, BEHAVIOR_ID)
+ } else if (expectedSpace === null) {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, expectedContext, AGENT_ID, BEHAVIOR_ID)
+ } else {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, expectedContext, expectedSpace, AGENT_ID, BEHAVIOR_ID)
+ }
+ }
+
+ @SuppressWarnings("unused_private_member")
+ private static def decode_URIFragment : Stream {
+ Stream::of(
+ Arguments::of("behavior://" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("",
+ null, 0, null, null),
+ Arguments::of("",
+ null, 0, null, null),
+ Arguments::of("",
+ null, 0, null, null),
+ Arguments::of("",
+ null, 0, null, null),
+ Arguments::of("",
+ null, 0, null, null)
+ )
+ }
+
+}
diff --git a/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserNormalizeURITest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserNormalizeURITest.sarl
new file mode 100644
index 0000000000..8948f36049
--- /dev/null
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/BehaviorSchemeNameParserNormalizeURITest.sarl
@@ -0,0 +1,218 @@
+/*
+ * $Id$
+ *
+ * SARL is an general-purpose agent programming language.
+ * More details on http://www.sarl.io
+ *
+ * Copyright (C) 2014-2020 the original authors or authors.
+ *
+ * Licensed 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 io.sarl.api.naming.tests.parser
+
+import java.util.stream.Stream
+import org.junit.jupiter.api.DisplayName
+import org.junit.jupiter.params.ParameterizedTest
+import org.junit.jupiter.params.provider.Arguments
+import org.junit.jupiter.params.provider.MethodSource
+
+import static extension org.junit.jupiter.api.Assertions.assertNull
+
+/**
+ * @author $Author: sgalland$
+ * @version $FullVersion$
+ * @mavengroupid $GroupId$
+ * @mavenartifactid $ArtifactId$
+ */
+@DisplayName("Behavior NameParser normalize(URI)")
+class BehaviorSchemeNameParserNormalizeURITest extends AbstractBehaviorSchemeNameParserTest {
+
+ @ParameterizedTest
+ @MethodSource
+ @DisplayName("normalize(URI)")
+ def normalize_URI(source : String,
+ expectedScheme : String, expectedIndex : int, expectedContext : String, expectedSpace : String) {
+ val actual = this.parser.normalize(source.createURI)
+ if (expectedScheme === null) {
+ actual.assertNull
+ } else if (expectedContext === null) {
+ actual.assertValid(expectedScheme, expectedIndex, AGENT_ID, BEHAVIOR_ID)
+ } else if (expectedSpace === null) {
+ actual.assertValid(expectedScheme, expectedIndex, expectedContext, AGENT_ID, BEHAVIOR_ID)
+ } else {
+ actual.assertValid(expectedScheme, expectedIndex, expectedContext, expectedSpace, AGENT_ID, BEHAVIOR_ID)
+ }
+ }
+
+ @SuppressWarnings("unused_private_member")
+ private static def normalize_URI : Stream {
+ Stream::of(
+ Arguments::of("behavior://" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID,
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ null, 0, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID,
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX,
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX,
+ null, 0, null, null)
+ )
+ }
+
+ @ParameterizedTest
+ @MethodSource
+ @DisplayName("normalize(URI+Fragment)")
+ def normalize_URIFragment(source : String, expectedScheme : String, expectedIndex : int, expectedContext : String, expectedSpace : String) {
+ val actual = this.parser.normalize(source.createURI)
+ if (expectedScheme === null) {
+ actual.assertNull
+ } else if (expectedContext === null) {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, AGENT_ID, BEHAVIOR_ID)
+ } else if (expectedSpace === null) {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, expectedContext, AGENT_ID, BEHAVIOR_ID)
+ } else {
+ actual.assertValid(expectedScheme, "frag", expectedIndex, expectedContext, expectedSpace, AGENT_ID, BEHAVIOR_ID)
+ }
+ }
+
+ @SuppressWarnings("unused_private_member")
+ private static def normalize_URIFragment : Stream {
+ Stream::of(
+ Arguments::of("behavior://" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior://" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior://" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior:/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:/" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, null, null),
+ Arguments::of("behavior:" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "#frag",
+ "behavior", -1, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "#frag",
+ "behavior", BEHAVIOR_IDX, CONTEXT_ID, SPACE_ID),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/" + BEHAVIOR_IDX + "/xxx#frag",
+ null, 0, null, null),
+ Arguments::of("behavior:" + CONTEXT_ID + "/" + SPACE_ID + "/" + AGENT_ID + "/" + BEHAVIOR_ID + "/xxx/" + BEHAVIOR_IDX + "#frag",
+ null, 0, null, null)
+ )
+ }
+
+}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ContextSchemeNameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/ContextSchemeNameParserTest.sarl
similarity index 94%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ContextSchemeNameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/ContextSchemeNameParserTest.sarl
index a050310e71..1795e08cb6 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ContextSchemeNameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/ContextSchemeNameParserTest.sarl
@@ -19,13 +19,11 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.parser
-import io.sarl.sre.naming.ContextName
-import io.sarl.sre.naming.ContextSchemeNameParser
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.name.ContextName
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.parser.ContextSchemeNameParser
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -41,6 +39,7 @@ import static extension io.sarl.tests.api.tools.TestAssertions.assertNullOrEmpty
import static extension org.junit.jupiter.api.Assertions.assertEquals
import static extension org.junit.jupiter.api.Assertions.assertNotNull
import static extension org.junit.jupiter.api.Assertions.assertNull
+import io.sarl.api.naming.parser.UriBasedNameParser
/**
* @author $Author: sgalland$
@@ -50,23 +49,22 @@ import static extension org.junit.jupiter.api.Assertions.assertNull
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: context NameParser test")
+@DisplayName("Context NameParser")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class ContextSchemeNameParserTest {
protected static val CONTEXT_ID = "2a2c6de4-8327-431b-a916-97a05caafe14"
@Nullable
- var parser : NameParser
+ var parser : UriBasedNameParser
@BeforeEach
def setUp : void {
- this.parser = new NameParser
+ this.parser = new UriBasedNameParser()
this.parser.addSchemeNameParser(new ContextSchemeNameParser)
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ServiceSchemeNameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/ServiceSchemeNameParserTest.sarl
similarity index 93%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ServiceSchemeNameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/ServiceSchemeNameParserTest.sarl
index 0bfa2b7aab..16cb5c63f0 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/ServiceSchemeNameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/ServiceSchemeNameParserTest.sarl
@@ -19,14 +19,13 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
-
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.naming.ServiceName
-import io.sarl.sre.naming.ServiceSchemeNameParser
-import io.sarl.sre.services.logging.LoggingService
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+package io.sarl.api.naming.tests.parser
+
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.name.ServiceName
+import io.sarl.api.naming.parser.ServiceSchemeNameParser
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.tests.mocks.ServiceMock
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -50,23 +49,22 @@ import static extension org.junit.jupiter.api.Assertions.assertNull
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: service NameParser test")
+@DisplayName("Service NameParser")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class ServiceSchemeNameParserTest {
- val SERVICE_ID = typeof(LoggingService).name
+ val SERVICE_ID = typeof(ServiceMock).name
@Nullable
- var parser : NameParser
+ var parser : UriBasedNameParser
@BeforeEach
def setUp : void {
- this.parser = new NameParser
+ this.parser = new UriBasedNameParser()
this.parser.addSchemeNameParser(new ServiceSchemeNameParser)
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SkillSchemeNameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/SkillSchemeNameParserTest.sarl
similarity index 97%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SkillSchemeNameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/SkillSchemeNameParserTest.sarl
index eee71099a0..8adda21819 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SkillSchemeNameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/SkillSchemeNameParserTest.sarl
@@ -19,14 +19,13 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
-
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.naming.SkillName
-import io.sarl.sre.naming.SkillSchemeNameParser
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
-import io.sarl.sre.tests.units.naming.mocks.CapacityMock
+package io.sarl.api.naming.tests.parser
+
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.name.SkillName
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.parser.SkillSchemeNameParser
+import io.sarl.api.naming.tests.mocks.CapacityMock
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -51,13 +50,12 @@ import static extension org.junit.jupiter.api.Assertions.assertNull
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: skill NameParser test")
+@DisplayName("Skill NameParser")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class SkillSchemeNameParserTest {
protected static val CONTEXT_ID = "2a2c6de4-8327-431b-a916-97a05caafe14"
@@ -69,11 +67,11 @@ class SkillSchemeNameParserTest {
protected static val SKILL_ID = typeof(CapacityMock).name
@Nullable
- var parser : NameParser
+ var parser : UriBasedNameParser
@BeforeEach
def setUp : void {
- this.parser = new NameParser
+ this.parser = new UriBasedNameParser
this.parser.addSchemeNameParser(new SkillSchemeNameParser)
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SpaceSchemeNameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/SpaceSchemeNameParserTest.sarl
similarity index 95%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SpaceSchemeNameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/SpaceSchemeNameParserTest.sarl
index 4017e00061..aa26a4bf3c 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/SpaceSchemeNameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/parser/SpaceSchemeNameParserTest.sarl
@@ -19,13 +19,12 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.parser
-import io.sarl.sre.naming.NameParser
-import io.sarl.sre.naming.SarlName
-import io.sarl.sre.naming.SpaceName
-import io.sarl.sre.naming.SpaceSchemeNameParser
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
+import io.sarl.api.naming.name.SarlName
+import io.sarl.api.naming.name.SpaceName
+import io.sarl.api.naming.parser.UriBasedNameParser
+import io.sarl.api.naming.parser.SpaceSchemeNameParser
import io.sarl.tests.api.Nullable
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
@@ -50,13 +49,12 @@ import static extension org.junit.jupiter.api.Assertions.assertNull
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: space NameParser test")
+@DisplayName("Space NameParser")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
+@Tag("api")
+@Tag("api-naming")
class SpaceSchemeNameParserTest {
protected static val CONTEXT_ID = "2a2c6de4-8327-431b-a916-97a05caafe14"
@@ -64,11 +62,11 @@ class SpaceSchemeNameParserTest {
protected static val SPACE_ID = "bb0d92be-1730-4453-a284-bd66d31b853f"
@Nullable
- var parser : NameParser
+ var parser : UriBasedNameParser
@BeforeEach
def setUp : void {
- this.parser = new NameParser
+ this.parser = new UriBasedNameParser
this.parser.addSchemeNameParser(new SpaceSchemeNameParser)
}
diff --git a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/INameParserTest.sarl b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/scheme/NameSchemesTest.sarl
similarity index 67%
rename from sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/INameParserTest.sarl
rename to tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/scheme/NameSchemesTest.sarl
index fc16174d63..425c3db561 100644
--- a/sre/io.janusproject/io.janusproject.tests/src/test/sarl/io/sarl/sre/tests/units/naming/INameParserTest.sarl
+++ b/tests/io.sarl.api.naming.tests/src/test/sarl/io/sarl/api/naming/tests/scheme/NameSchemesTest.sarl
@@ -19,11 +19,8 @@
* limitations under the License.
*/
-package io.sarl.sre.tests.units.naming
+package io.sarl.api.naming.tests.scheme
-import io.sarl.sre.naming.INameParser
-import io.sarl.sre.naming.NameScheme
-import io.sarl.sre.test.framework.^extension.PropertyRestoreExtension
import io.sarl.tests.api.extensions.ContextInitExtension
import io.sarl.tests.api.extensions.JavaVersionCheckExtension
import org.junit.jupiter.api.DisplayName
@@ -31,8 +28,9 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.^extension.ExtendWith
-import static extension org.junit.jupiter.api.Assertions.assertNull
-import static extension org.junit.jupiter.api.Assertions.assertSame
+import static extension org.junit.jupiter.api.Assertions.*
+import io.sarl.api.naming.scheme.NameSchemes
+import io.sarl.api.naming.scheme.NameScheme
/**
* @author $Author: sgalland$
@@ -42,35 +40,34 @@ import static extension org.junit.jupiter.api.Assertions.assertSame
*/
@ExtendWith(#[
typeof(ContextInitExtension),
- typeof(JavaVersionCheckExtension),
- typeof(PropertyRestoreExtension)
+ typeof(JavaVersionCheckExtension)
])
-@DisplayName("unit: INameParser test")
+@DisplayName("NameSchemes")
@Tag("unit")
-@Tag("janus")
-@Tag("sre-unit")
-class INameParserTest {
+@Tag("api")
+@Tag("api-naming")
+class NameSchemesTest {
@Test
def getSchemeObject_String_null {
- INameParser::getSchemeObject(null).assertNull
+ NameSchemes::getSchemeObject(null).assertNull
}
@Test
def getSchemeObject_String_empty {
- INameParser::getSchemeObject("").assertNull
+ NameSchemes::getSchemeObject("").assertNull
}
@Test
def getSchemeObject_String_validScheme {
for (expected : NameScheme::values) {
- INameParser::getSchemeObject(expected.name.toLowerCase).assertSame(expected)
+ NameSchemes::getSchemeObject(expected.name.toLowerCase).assertSame(expected)
}
}
@Test
def getSchemeObject_String_http {
- INameParser::getSchemeObject("http").assertNull
+ NameSchemes::getSchemeObject("http").assertNull
}
}
diff --git a/tests/pom.xml b/tests/pom.xml
index 308e34c8e0..a930614c2a 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -25,6 +25,7 @@
io.sarl.lang.tests
io.sarl.util.tests
io.sarl.core.tests
+ io.sarl.api.naming.tests
sarl-maven-plugin.tests
io.sarl.maven.docs.generator.tests