|
From: <lh...@us...> - 2008-08-06 13:56:35
|
Revision: 56
http://tmapi.svn.sourceforge.net/tmapi/?rev=56&view=rev
Author: lheuer
Date: 2008-08-06 13:56:44 +0000 (Wed, 06 Aug 2008)
Log Message:
-----------
- DatatypeAware: Switched from IllegalStateException to NumberFormatException and IllegalArgumentException
- TestTopicMerge: Removed unnecessary Exception declaration
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/DatatypeAware.java
trunk/src/test/java/org/tmapi/core/TestTopicMerge.java
Modified: trunk/src/main/java/org/tmapi/core/DatatypeAware.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/DatatypeAware.java 2008-08-06 12:35:05 UTC (rev 55)
+++ trunk/src/main/java/org/tmapi/core/DatatypeAware.java 2008-08-06 13:56:44 UTC (rev 56)
@@ -130,7 +130,7 @@
* Returns the <tt>int</tt> representation of the value.
*
* @return An <tt>int</tt> representation of the value.
- * @throws IllegalStateException If the value cannot be represented as
+ * @throws NumberFormatException If the value cannot be represented as
* a <tt>int</tt>.
*/
public int intValue();
@@ -139,7 +139,7 @@
* Returns the {@link BigInteger} representation of the value.
*
* @return A {@link BigInteger} representation of the value.
- * @throws IllegalStateException If the value cannot be represented as
+ * @throws NumberFormatException If the value cannot be represented as
* a {@link BigInteger} instance.
*/
public BigInteger integerValue();
@@ -148,7 +148,7 @@
* Returns the <tt>float</tt> representation of the value.
*
* @return A <tt>float</tt> representation of the value.
- * @throws IllegalStateException If the value cannot be represented as
+ * @throws NumberFormatException If the value cannot be represented as
* a <tt>float</tt>.
*/
public float floatValue();
@@ -157,7 +157,7 @@
* Returns the {@link BigDecimal} representation of the value.
*
* @return A {@link BigDecimal} representation of the value.
- * @throws IllegalStateException If the value cannot be represented as
+ * @throws NumberFormatException If the value cannot be represented as
* a {@link BigDecimal} instance.
*/
public BigDecimal decimalValue();
@@ -166,7 +166,7 @@
* Returns the <tt>long</tt> representation of the value.
*
* @return A <tt>long</tt> representation of the value.
- * @throws IllegalStateException If the value cannot be represented as
+ * @throws NumberFormatException If the value cannot be represented as
* a <tt>long</tt>.
*/
public long longValue();
@@ -175,7 +175,7 @@
* Returns the {@link Locator} representation of the value.
*
* @return A {@link Locator} representation of the value.
- * @throws IllegalStateException If the value cannot be represented as
+ * @throws IllegalArgumentException If the value cannot be represented as
* a {@link Locator} instance.
*/
public Locator locatorValue();
Modified: trunk/src/test/java/org/tmapi/core/TestTopicMerge.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestTopicMerge.java 2008-08-06 12:35:05 UTC (rev 55)
+++ trunk/src/test/java/org/tmapi/core/TestTopicMerge.java 2008-08-06 13:56:44 UTC (rev 56)
@@ -25,10 +25,10 @@
super(name);
}
- /*
+ /**
*Tests if the types are merged too
*/
- public void testTypesMerged() throws Exception {
+ public void testTypesMerged() {
Topic t1 = createTopic();
Topic t2 = createTopic();
Topic t3 = createTopic();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lh...@us...> - 2008-08-08 12:00:46
|
Revision: 62
http://tmapi.svn.sourceforge.net/tmapi/?rev=62&view=rev
Author: lheuer
Date: 2008-08-08 12:00:50 +0000 (Fri, 08 Aug 2008)
Log Message:
-----------
- Docs for the exceptions
- Minor doc tweaks (<p/>'s etc)
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/Association.java
trunk/src/main/java/org/tmapi/core/Construct.java
trunk/src/main/java/org/tmapi/core/DatatypeAware.java
trunk/src/main/java/org/tmapi/core/FactoryConfigurationException.java
trunk/src/main/java/org/tmapi/core/FeatureNotRecognizedException.java
trunk/src/main/java/org/tmapi/core/FeatureNotSupportedException.java
trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java
trunk/src/main/java/org/tmapi/core/Locator.java
trunk/src/main/java/org/tmapi/core/ModelConstraintException.java
trunk/src/main/java/org/tmapi/core/Name.java
trunk/src/main/java/org/tmapi/core/Occurrence.java
trunk/src/main/java/org/tmapi/core/Reifiable.java
trunk/src/main/java/org/tmapi/core/Role.java
trunk/src/main/java/org/tmapi/core/Scoped.java
trunk/src/main/java/org/tmapi/core/TMAPIException.java
trunk/src/main/java/org/tmapi/core/TMAPIRuntimeException.java
trunk/src/main/java/org/tmapi/core/Topic.java
trunk/src/main/java/org/tmapi/core/TopicInUseException.java
trunk/src/main/java/org/tmapi/core/TopicMap.java
trunk/src/main/java/org/tmapi/core/TopicMapExistsException.java
trunk/src/main/java/org/tmapi/core/TopicMapSystem.java
trunk/src/main/java/org/tmapi/core/TopicMapSystemFactory.java
trunk/src/main/java/org/tmapi/core/Typed.java
trunk/src/main/java/org/tmapi/core/Variant.java
trunk/src/main/java/org/tmapi/index/Index.java
trunk/src/main/java/org/tmapi/index/LiteralIndex.java
trunk/src/main/java/org/tmapi/index/ScopedIndex.java
trunk/src/main/java/org/tmapi/index/TypeInstanceIndex.java
trunk/src/test/java/org/tmapi/core/AllCoreTests.java
trunk/src/test/java/org/tmapi/core/TMAPITestCase.java
trunk/src/test/java/org/tmapi/core/TestAssociation.java
trunk/src/test/java/org/tmapi/core/TestConstruct.java
trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java
trunk/src/test/java/org/tmapi/core/TestLocator.java
trunk/src/test/java/org/tmapi/core/TestName.java
trunk/src/test/java/org/tmapi/core/TestOccurrence.java
trunk/src/test/java/org/tmapi/core/TestReified.java
trunk/src/test/java/org/tmapi/core/TestRole.java
trunk/src/test/java/org/tmapi/core/TestScoped.java
trunk/src/test/java/org/tmapi/core/TestTopic.java
trunk/src/test/java/org/tmapi/core/TestTopicMap.java
trunk/src/test/java/org/tmapi/core/TestTopicMapMerge.java
trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java
trunk/src/test/java/org/tmapi/core/TestTopicMerge.java
trunk/src/test/java/org/tmapi/core/TestTopicMergeDetection.java
trunk/src/test/java/org/tmapi/core/TestTyped.java
trunk/src/test/java/org/tmapi/core/TestVariant.java
trunk/src/test/java/org/tmapi/index/AllIndexTests.java
trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java
trunk/src/test/java/org/tmapi/index/TestScopedIndex.java
trunk/src/test/java/org/tmapi/index/TestTypeInstanceIndex.java
Modified: trunk/src/main/java/org/tmapi/core/Association.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Association.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Association.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -19,7 +19,7 @@
* Represents an
* <a href="http://www.isotopicmaps.org/sam/sam-model/#sect-association">association item</a>.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Association extends Reifiable, Typed, Scoped {
@@ -44,7 +44,7 @@
/**
* Returns the role types participating in this association.
- *
+ * <p>
* This method returns the same result as the following code:
* <pre>
* Set<Topic> types = new HashSet<Topic>();
@@ -52,7 +52,7 @@
* types.add(role.getType());
* }
* </pre>
- *
+ * </p>
* The return value may be empty but must never be <tt>null</tt>.
*
* @return An unmodifiable set of role types.
@@ -61,7 +61,7 @@
/**
* Returns all roles with the specified <tt>type</tt>.
- *
+ * <p>
* This method returns the same result as the following code:
* <pre>
* Set<Role> roles = new HashSet<Role>();
@@ -71,7 +71,7 @@
* }
* }
* </pre>
- *
+ * </p>
* The return value may be empty but must never be <tt>null</tt>.
*
* @param type The type of the {@link Role} instances to be returned,
Modified: trunk/src/main/java/org/tmapi/core/Construct.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Construct.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Construct.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -18,7 +18,7 @@
/**
* Base interface for all Topic Maps constructs.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Construct {
Modified: trunk/src/main/java/org/tmapi/core/DatatypeAware.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/DatatypeAware.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/DatatypeAware.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -18,12 +18,13 @@
/**
* Common base interface for {@link Occurrence}s and {@link Variant}s.
- *
+ * <p>
* Some convenience methods for a subset of
* <a href="http://www.w3.org/TR/xmlschema-2/">XML Schema Part 2: Datatypes</a>
* are supported.
+ * </p>
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface DatatypeAware extends Reifiable, Scoped {
@@ -38,12 +39,13 @@
/**
* Returns the lexical representation of the value.
- *
+ * <p>
* For the datatype <a href="http://www.w3.org/TR/xmlschema-2/#string">xsd:string</a>
* the string itself is returned. For the datatype
* <a href="http://www.w3.org/TR/xmlschema-2/#anyURI">xsd:anyURI</a>
* the {@link Locator#getReference()} is returned.
- *
+ * </p>
+ *
* @return The lexical representation of the value (never <tt>null</tt>).
*/
public String getValue();
@@ -60,10 +62,11 @@
/**
* Sets the IRI value.
- *
+ * <p>
* This method sets the datatype implicitly to
* <a href="http://www.w3.org/TR/xmlschema-2/#anyURI">xsd:anyURI</a>.
- *
+ * </p>
+ *
* @param value The IRI value.
*/
public void setValue(Locator value);
@@ -78,50 +81,55 @@
/**
* Sets the decimal value.
- *
+ * <p>
* This method sets the datatype implicitly to
* <a href="http://www.w3.org/TR/xmlschema-2/#decimal">xsd:decimal</a>.
- *
+ * </p>
+ *
* @param value The decimal value.
*/
public void setValue(BigDecimal value);
/**
* Sets the integer value.
- *
+ * <p>
* This method sets the datatype implicitly to
* <a href="http://www.w3.org/TR/xmlschema-2/#integer">xsd:integer</a>.
- *
+ * </p>
+ *
* @param value The integer value.
*/
public void setValue(BigInteger value);
/**
* Sets the long value.
- *
+ * <p>
* This method sets the datatype implicitly to
* <a href="http://www.w3.org/TR/xmlschema-2/#long">xsd:long</a>.
- *
+ * </p>
+ *
* @param value The integer value.
*/
public void setValue(long value);
/**
* Sets the float value.
- *
+ * <p>
* This method sets the datatype implicitly to
* <a href="http://www.w3.org/TR/xmlschema-2/#float">xsd:float</a>.
- *
+ * </p>
+ *
* @param value The float value.
*/
public void setValue(float value);
/**
* Sets the int value.
- *
+ * <p>
* This method sets the datatype implicitly to
* <a href="http://www.w3.org/TR/xmlschema-2/#int">xsd:int</a>.
- *
+ * </p>
+ *
* @param value The int value.
*/
public void setValue(int value);
Modified: trunk/src/main/java/org/tmapi/core/FactoryConfigurationException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/FactoryConfigurationException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/FactoryConfigurationException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -18,42 +18,45 @@
* cannot be instantiated through the method
* {@link TopicMapSystemFactory#newInstance()}.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public class FactoryConfigurationException extends TMAPIException {
- /**
- *
- */
private static final long serialVersionUID = -6197383571197389854L;
/**
- *
+ * Constructs a new throwable with the specified detail message.
*
- * @param msg
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
- public FactoryConfigurationException(String msg) {
- super(msg);
+ public FactoryConfigurationException(String message) {
+ super(message);
}
/**
- *
+ * Constructs a new exception that wraps another exception.
*
- * @param cause
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
public FactoryConfigurationException(Throwable cause) {
super(cause);
}
/**
- *
+ * Constructs a new throwable with the specified detail message.
*
- * @param msg
- * @param cause
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
- public FactoryConfigurationException(String msg, Throwable cause) {
- super(msg, cause);
+ public FactoryConfigurationException(String message, Throwable cause) {
+ super(message, cause);
}
}
Modified: trunk/src/main/java/org/tmapi/core/FeatureNotRecognizedException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/FeatureNotRecognizedException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/FeatureNotRecognizedException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -13,47 +13,49 @@
*/
package org.tmapi.core;
-
/**
* Exception thrown when the TopicMapSystemFactory does not recognize
* the name of a feature that the application is trying to enable or disable.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public class FeatureNotRecognizedException extends FactoryConfigurationException {
- /**
- *
- */
private static final long serialVersionUID = 6231608065963599726L;
/**
- *
+ * Constructs a new throwable with the specified detail message.
*
- * @param msg
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
- public FeatureNotRecognizedException(String msg) {
- super(msg);
+ public FeatureNotRecognizedException(String message) {
+ super(message);
}
/**
- *
+ * Constructs a new exception that wraps another exception.
*
- * @param cause
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
public FeatureNotRecognizedException(Throwable cause) {
super(cause);
}
/**
- *
+ * Constructs a new throwable with the specified detail message.
*
- * @param msg
- * @param cause
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
- public FeatureNotRecognizedException(String msg, Throwable cause) {
- super(msg, cause);
+ public FeatureNotRecognizedException(String message, Throwable cause) {
+ super(message, cause);
}
}
Modified: trunk/src/main/java/org/tmapi/core/FeatureNotSupportedException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/FeatureNotSupportedException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/FeatureNotSupportedException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -19,26 +19,45 @@
* implementations <strong>MUST</strong> throw a FeatureNotRecognizedException
* rather than a FeatureNotSupportedException.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public class FeatureNotSupportedException extends FactoryConfigurationException {
+ private static final long serialVersionUID = -6901109695537829395L;
+
/**
- *
+ * Constructs a new throwable with the specified detail message.
+ *
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
- private static final long serialVersionUID = -6901109695537829395L;
-
- public FeatureNotSupportedException(String msg) {
- super(msg);
+ public FeatureNotSupportedException(String message) {
+ super(message);
}
+ /**
+ * Constructs a new exception that wraps another exception.
+ *
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
+ */
public FeatureNotSupportedException(Throwable cause) {
super(cause);
}
- public FeatureNotSupportedException(String msg, Throwable cause) {
- super(msg, cause);
+ /**
+ * Constructs a new throwable with the specified detail message.
+ *
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
+ */
+ public FeatureNotSupportedException(String message, Throwable cause) {
+ super(message, cause);
}
}
Modified: trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -20,12 +20,11 @@
* to different objects causes an <tt>IdentityConstraintException</tt> to be
* thrown.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev: 33 $ - $Date: 2008-08-02 16:42:29 +0200 (Sa, 02 Aug 2008) $
*/
public class IdentityConstraintException extends ModelConstraintException {
-
private static final long serialVersionUID = -8239221052536586370L;
private final Construct _existing;
Modified: trunk/src/main/java/org/tmapi/core/Locator.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Locator.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Locator.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -16,7 +16,7 @@
/**
* Immutable representation of an IRI.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Locator {
Modified: trunk/src/main/java/org/tmapi/core/ModelConstraintException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/ModelConstraintException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/ModelConstraintException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -18,7 +18,7 @@
* <a href="http://www.isotopicmaps.org/sam/sam-model/">Topic Maps \x97 Data Model</a>
* constraint violations.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev: 33 $ - $Date: 2008-08-02 16:42:29 +0200 (Sa, 02 Aug 2008) $
*/
public class ModelConstraintException extends TMAPIRuntimeException {
@@ -43,7 +43,7 @@
* Returns the {@link Construct} which has thrown the exception.
*
* @return The construct which has thrown the exception or <tt>null</tt>
- * if no approbiate construct is available (i.e. in the factory
+ * if no appropiate construct is available (i.e. in the factory
* methods).
*/
public Construct getSender() {
Modified: trunk/src/main/java/org/tmapi/core/Name.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Name.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Name.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -20,7 +20,7 @@
* Represents a
* <a href="http://www.isotopicmaps.org/sam/sam-model/#sect-topic-name">topic name item</a>.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Name extends Typed, Scoped, Reifiable {
@@ -62,10 +62,11 @@
/**
* Creates a {@link Variant} of this topic name with the specified string
* <tt>value</tt> and <tt>scope</tt>.
- *
+ * <p>
* The newly created {@link Variant} will have the datatype
* <a href="http://www.w3.org/TR/xmlschema-2/#string">xsd:string</a>.
- *
+ * </p>
+ *
* @param value The string value.
* @param scope An array (length >= 1) of themes.
* @return The newly created {@link Variant}
@@ -77,10 +78,11 @@
/**
* Creates a {@link Variant} of this topic name with the specified string
* <tt>value</tt> and <tt>scope</tt>.
- *
+ * <p>
* The newly created {@link Variant} will have the datatype
* <a href="http://www.w3.org/TR/xmlschema-2/#string">xsd:string</a>.
- *
+ * </p>
+ *
* @param value The string value.
* @param scope A collection (size >= 1) of themes.
* @return The newly created {@link Variant}
@@ -92,10 +94,11 @@
/**
* Creates a {@link Variant} of this topic name with the specified IRI
* <tt>value</tt> and <tt>scope</tt>.
- *
+ * <p>
* The newly created {@link Variant} will have the datatype
* <a href="http://www.w3.org/TR/xmlschema-2/#anyURI">xsd:anyURI</a>.
- *
+ * </p>
+ *
* @param value A locator which represents an IRI.
* @param scope An array (length >= 1) of themes.
* @return The newly created {@link Variant}
@@ -107,10 +110,11 @@
/**
* Creates a {@link Variant} of this topic name with the specified IRI
* <tt>value</tt> and <tt>scope</tt>.
- *
+ * <p>
* The newly created {@link Variant} will have the datatype
* <a href="http://www.w3.org/TR/xmlschema-2/#anyURI">xsd:anyURI</a>.
- *
+ * </p>
+ *
* @param value A locator which represents an IRI.
* @param scope A collection (size >= 1) of themes.
* @return The newly created {@link Variant}
@@ -122,10 +126,11 @@
/**
* Creates a {@link Variant} of this topic name with the specified IRI
* <tt>value</tt>, <tt>datatype</tt>, and <tt>scope</tt>.
- *
+ * <p>
* The newly created {@link Variant} will have the datatype specified by
* <tt>datatype</tt>.
- *
+ * </p>
+ *
* @param value A lexical string representation of the value.
* @param datatype A locator indicating the datatype of the <tt>value</tt>.
* @param scope An array (length >= 1) of themes.
@@ -138,10 +143,11 @@
/**
* Creates a {@link Variant} of this topic name with the specified IRI
* <tt>value</tt>, <tt>datatype</tt>, and <tt>scope</tt>.
- *
+ * <p>
* The newly created {@link Variant} will have the datatype specified by
* <tt>datatype</tt>.
- *
+ * </p>
+ *
* @param value A lexical string representation of the value.
* @param datatype A locator indicating the datatype of the <tt>value</tt>.
* @param scope A collection (size >= 1) of themes.
Modified: trunk/src/main/java/org/tmapi/core/Occurrence.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Occurrence.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Occurrence.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -17,7 +17,7 @@
* Represents an
* <a href="http://www.isotopicmaps.org/sam/sam-model/#sect-occurrence">occurrence item</a>.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Occurrence extends Typed, DatatypeAware {
Modified: trunk/src/main/java/org/tmapi/core/Reifiable.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Reifiable.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Reifiable.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -18,7 +18,7 @@
*
* Every Topic Maps construct that is not a {@link Topic} is reifiable.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Reifiable extends Construct {
Modified: trunk/src/main/java/org/tmapi/core/Role.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Role.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Role.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -17,7 +17,7 @@
* Represents an
* <a href="http://www.isotopicmaps.org/sam/sam-model/#sect-assoc-role">association role item</a>.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Role extends Reifiable, Typed {
Modified: trunk/src/main/java/org/tmapi/core/Scoped.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Scoped.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Scoped.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -21,7 +21,7 @@
* {@link Association}s, {@link Occurrence}s, {@link Name}s, and
* {@link Variant}s are scoped.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Scoped extends Construct {
Modified: trunk/src/main/java/org/tmapi/core/TMAPIException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TMAPIException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/TMAPIException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -17,47 +17,42 @@
* The base class for all standard (non run-time) exceptions thrown by a
* TMAPI system.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public class TMAPIException extends Exception {
- /**
- *
- */
private static final long serialVersionUID = -804738055960757078L;
/**
- *
+ * Constructs a new throwable with the specified detail message.
*
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
- public TMAPIException() {
- super();
- }
-
- /**
- *
- *
- * @param message
- * @param cause
- */
public TMAPIException(String message, Throwable cause) {
super(message, cause);
}
/**
- *
+ * Constructs a new throwable with the specified detail message.
*
- * @param message
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
public TMAPIException(String message) {
super(message);
}
/**
- *
+ * Constructs a new exception that wraps another exception.
*
- * @param cause
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
public TMAPIException(Throwable cause) {
super(cause);
Modified: trunk/src/main/java/org/tmapi/core/TMAPIRuntimeException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TMAPIRuntimeException.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/TMAPIRuntimeException.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -18,39 +18,42 @@
* is an error in the underlying topic map processing system or when integrity
* constraints are violated.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev:$ - $Date:$
*/
public class TMAPIRuntimeException extends RuntimeException {
- /**
- *
- */
private static final long serialVersionUID = -5272967154641022529L;
/**
- *
- *
- * @param msg
- * @param cause
+ * Constructs a new throwable with the specified detail message.
+ *
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
- public TMAPIRuntimeException(String msg, Throwable cause) {
- super(msg, cause);
+ public TMAPIRuntimeException(String message, Throwable cause) {
+ super(message, cause);
}
/**
- *
- *
- * @param msg
+ * Constructs a new throwable with the specified detail message.
+ *
+ * @param message The detail message. This message is saved for later
+ * retrieval by the {@link #getMessage()} method.
*/
- public TMAPIRuntimeException(String msg) {
- super(msg);
+ public TMAPIRuntimeException(String message) {
+ super(message);
}
/**
- *
- *
- * @param cause
+ * Constructs a new exception that wraps another exception.
+ *
+ * @param cause The throwable which caused this exception to be thrown.
+ * This value is saved for later retrieval by the
+ * {@link #getCause()} method.
*/
public TMAPIRuntimeException(Throwable cause) {
super(cause);
Modified: trunk/src/main/java/org/tmapi/core/Topic.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Topic.java 2008-08-07 11:25:25 UTC (rev 61)
+++ trunk/src/main/java/org/tmapi/core/Topic.java 2008-08-08 12:00:50 UTC (rev 62)
@@ -20,7 +20,7 @@
* Represents a
* <a href="http://www.isotopicmaps.org/sam/sam-model/#d0e739">topic item</a>.
*
- * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @version $Rev$ - $Date$
*/
public interface Topic extends Construct {
@@ -36,11 +36,12 @@
/**
* Adds an item identifier to this topic.
- *
+ * <p>
* If adding the specified item identifier would make this topic
* represent the same subject as another topic and the feature
* "automerge" (http://tmapi.org/features/automerge) is disabled,
* an {@link IdentityConstraintException} is thrown.
+ * </p>
*
* @see org.tmapi.core.Construct#addItem...
[truncated message content] |
|
From: <lh...@us...> - 2008-08-09 16:08:04
|
Revision: 63
http://tmapi.svn.sourceforge.net/tmapi/?rev=63&view=rev
Author: lheuer
Date: 2008-08-09 16:08:12 +0000 (Sat, 09 Aug 2008)
Log Message:
-----------
TopicMap.getIndex() uses Generics to avoid casting
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/TopicMap.java
trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java
trunk/src/test/java/org/tmapi/index/TestScopedIndex.java
trunk/src/test/java/org/tmapi/index/TestTypeInstanceIndex.java
Modified: trunk/src/main/java/org/tmapi/core/TopicMap.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TopicMap.java 2008-08-08 12:00:50 UTC (rev 62)
+++ trunk/src/main/java/org/tmapi/core/TopicMap.java 2008-08-09 16:08:12 UTC (rev 63)
@@ -237,6 +237,6 @@
* @throws UnsupportedOperationException If the implementation does not
* support indices or if the specified index is unsupported.
*/
- public Index getIndex(Class<? extends Index> indexInterface);
+ public <I extends Index> I getIndex(Class<I> indexInterface);
}
Modified: trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java
===================================================================
--- trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java 2008-08-08 12:00:50 UTC (rev 62)
+++ trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java 2008-08-09 16:08:12 UTC (rev 63)
@@ -43,7 +43,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- _litIdx = (LiteralIndex) _tm.getIndex(LiteralIndex.class);
+ _litIdx = _tm.getIndex(LiteralIndex.class);
_litIdx.open();
final String XSD_BASE = "http://www.w3.org/2001/XMLSchema#";
_xsdString = createLocator(XSD_BASE + "string");
Modified: trunk/src/test/java/org/tmapi/index/TestScopedIndex.java
===================================================================
--- trunk/src/test/java/org/tmapi/index/TestScopedIndex.java 2008-08-08 12:00:50 UTC (rev 62)
+++ trunk/src/test/java/org/tmapi/index/TestScopedIndex.java 2008-08-09 16:08:12 UTC (rev 63)
@@ -42,7 +42,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- _scopedIdx = (ScopedIndex) _tm.getIndex(ScopedIndex.class);
+ _scopedIdx = _tm.getIndex(ScopedIndex.class);
_scopedIdx.open();
}
Modified: trunk/src/test/java/org/tmapi/index/TestTypeInstanceIndex.java
===================================================================
--- trunk/src/test/java/org/tmapi/index/TestTypeInstanceIndex.java 2008-08-08 12:00:50 UTC (rev 62)
+++ trunk/src/test/java/org/tmapi/index/TestTypeInstanceIndex.java 2008-08-09 16:08:12 UTC (rev 63)
@@ -41,7 +41,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- _typeInstanceIdx = (TypeInstanceIndex) _tm.getIndex(TypeInstanceIndex.class);
+ _typeInstanceIdx = _tm.getIndex(TypeInstanceIndex.class);
_typeInstanceIdx.open();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lh...@us...> - 2008-08-14 11:46:38
|
Revision: 64
http://tmapi.svn.sourceforge.net/tmapi/?rev=64&view=rev
Author: lheuer
Date: 2008-08-14 11:46:44 +0000 (Thu, 14 Aug 2008)
Log Message:
-----------
- ModelConstraintException for all factory methods
- Explicit tests for IllegalArgumentException and ModelConstraintException
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/Association.java
trunk/src/main/java/org/tmapi/core/DatatypeAware.java
trunk/src/main/java/org/tmapi/core/Name.java
trunk/src/main/java/org/tmapi/core/Role.java
trunk/src/main/java/org/tmapi/core/Scoped.java
trunk/src/main/java/org/tmapi/core/Topic.java
trunk/src/main/java/org/tmapi/core/TopicMap.java
trunk/src/main/java/org/tmapi/core/Typed.java
trunk/src/main/java/org/tmapi/core/Variant.java
trunk/src/test/java/org/tmapi/core/TestAssociation.java
trunk/src/test/java/org/tmapi/core/TestConstruct.java
trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java
trunk/src/test/java/org/tmapi/core/TestName.java
trunk/src/test/java/org/tmapi/core/TestRole.java
trunk/src/test/java/org/tmapi/core/TestScoped.java
trunk/src/test/java/org/tmapi/core/TestTopic.java
trunk/src/test/java/org/tmapi/core/TestTopicMap.java
trunk/src/test/java/org/tmapi/core/TestTyped.java
trunk/src/test/java/org/tmapi/index/TestScopedIndex.java
Modified: trunk/src/main/java/org/tmapi/core/Association.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Association.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Association.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -78,6 +78,7 @@
* must not be <tt>null</tt>.
* @return An unmodifiable (maybe empty) set of roles with the specified
* <tt>type</tt> property.
+ * @throws IllegalArgumentException In case the <tt>type</tt> is <tt>null</tt>.
*/
public Set<Role> getRoles(Topic type);
@@ -87,6 +88,8 @@
* @param type The role type; MUST NOT be <tt>null</tt>.
* @param player The role player; MUST NOT be <tt>null</tt>.
* @return A newly created association role.
+ * @throws ModelConstraintException In case the role <tt>type</tt> or
+ * <tt>player</tt> is <tt>null</tt>.
*/
public Role createRole(Topic type, Topic player);
Modified: trunk/src/main/java/org/tmapi/core/DatatypeAware.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/DatatypeAware.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/DatatypeAware.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -68,6 +68,7 @@
* </p>
*
* @param value The IRI value.
+ * @throws ModelConstraintException In case the <tt>value</tt> is <tt>null</tt>.
*/
public void setValue(Locator value);
@@ -76,6 +77,8 @@
*
* @param value The string value.
* @param datatype The value's datatype.
+ * @throws ModelConstraintException In case the <tt>value</tt> or <tt>datatype</tt>
+ * is <tt>null</tt>.
*/
public void setValue(String value, Locator datatype);
@@ -87,6 +90,7 @@
* </p>
*
* @param value The decimal value.
+ * @throws ModelConstraintException In case the <tt>value</tt> is <tt>null</tt>.
*/
public void setValue(BigDecimal value);
@@ -98,6 +102,7 @@
* </p>
*
* @param value The integer value.
+ * @throws ModelConstraintException In case the <tt>value</tt> is <tt>null</tt>.
*/
public void setValue(BigInteger value);
Modified: trunk/src/main/java/org/tmapi/core/Name.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Name.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Name.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -47,6 +47,7 @@
* The previous value is overridden.
*
* @param value The name string to be assigned to the name.
+ * @throws ModelConstraintException If the the <tt>value</tt> is <tt>null</tt>.
*/
public void setValue(String value);
@@ -70,8 +71,9 @@
* @param value The string value.
* @param scope An array (length >= 1) of themes.
* @return The newly created {@link Variant}
- * @throws ModelConstraintException If the scope of the variant would
- * not be a true superset of the name's scope.
+ * @throws ModelConstraintException If the <tt>value</tt> is <tt>null</tt>,
+ * or the scope of the variant would not be a true superset of the
+ * name's scope.
*/
public Variant createVariant(String value, Topic... scope);
@@ -86,8 +88,9 @@
* @param value The string value.
* @param scope A collection (size >= 1) of themes.
* @return The newly created {@link Variant}
- * @throws ModelConstraintException If the scope of the variant would
- * not be a true superset of the name's scope.
+ * @throws ModelConstraintException If the <tt>value</tt> is <tt>null</tt>,
+ * or the scope of the variant would not be a true superset of the
+ * name's scope.
*/
public Variant createVariant(String value, Collection<Topic> scope);
@@ -102,8 +105,9 @@
* @param value A locator which represents an IRI.
* @param scope An array (length >= 1) of themes.
* @return The newly created {@link Variant}
- * @throws ModelConstraintException If the scope of the variant would
- * not be a true superset of the name's scope.
+ * @throws ModelConstraintException If the <tt>value</tt> is <tt>null</tt>,
+ * or the scope of the variant would not be a true superset of the
+ * name's scope.
*/
public Variant createVariant(Locator value, Topic... scope);
@@ -118,8 +122,9 @@
* @param value A locator which represents an IRI.
* @param scope A collection (size >= 1) of themes.
* @return The newly created {@link Variant}
- * @throws ModelConstraintException If the scope of the variant would
- * not be a true superset of the name's scope.
+ * @throws ModelConstraintException If the <tt>value</tt> is <tt>null</tt>,
+ * or the scope of the variant would not be a true superset of the
+ * name's scope.
*/
public Variant createVariant(Locator value, Collection<Topic> scope);
@@ -135,8 +140,9 @@
* @param datatype A locator indicating the datatype of the <tt>value</tt>.
* @param scope An array (length >= 1) of themes.
* @return The newly created {@link Variant}
- * @throws ModelConstraintException If the scope of the variant would
- * not be a true superset of the name's scope.
+ * @throws ModelConstraintException If the <tt>value</tt> or <tt>datatype</tt>
+ * is <tt>null</tt>, or the scope of the variant would not be a
+ * true superset of the name's scope.
*/
public Variant createVariant(String value, Locator datatype, Topic... scope);
@@ -152,8 +158,9 @@
* @param datatype A locator indicating the datatype of the <tt>value</tt>.
* @param scope A collection (size >= 1) of themes.
* @return The newly created {@link Variant}
- * @throws ModelConstraintException If the scope of the variant would
- * not be a true superset of the name's scope.
+ * @throws ModelConstraintException If the <tt>value</tt> or <tt>datatype</tt>
+ * is <tt>null</tt>, or the scope of the variant would not be a
+ * true superset of the name's scope.
*/
public Variant createVariant(String value, Locator datatype,
Collection<Topic> scope);
Modified: trunk/src/main/java/org/tmapi/core/Role.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Role.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Role.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -44,6 +44,7 @@
* Any previous role player will be overriden by <tt>player</tt>.
*
* @param player The topic which should play this role.
+ * @throws ModelConstraintException If the <tt>player</tt> is <tt>null</tt>.
*/
public void setPlayer(Topic player);
}
Modified: trunk/src/main/java/org/tmapi/core/Scoped.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Scoped.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Scoped.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -41,6 +41,7 @@
* Adds a topic to the scope.
*
* @param theme The topic which should be added to the scope.
+ * @throws ModelConstraintException If the <tt>theme</tt> is <tt>null</tt>.
*/
public void addTheme(Topic theme);
Modified: trunk/src/main/java/org/tmapi/core/Topic.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Topic.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Topic.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -142,6 +142,7 @@
* must not be <tt>null</tt>.
* @return An unmodifiable set of {@link Name}s with the specified
* <tt>type</tt>.
+ * @throws IllegalArgumentException If the <tt>type</tt> is <tt>null</tt>.
*/
public Set<Name> getNames(Topic type);
@@ -155,6 +156,8 @@
* the array's length is <tt>0</tt>, the name will be
* in the unconstrained scope.
* @return The newly created {@link Name}
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, or <tt>scope</tt> is <tt>null</tt>.
*/
public Name createName(Topic type, String value, Topic... scope);
@@ -167,6 +170,8 @@
* @param scope A collection of themes or <tt>null</tt> if the name should
* be in the unconstrained scope.
* @return The newly created {@link Name}
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, or <tt>scope</tt> is <tt>null</tt>.
*/
public Name createName(Topic type, String value, Collection<Topic> scope);
@@ -184,6 +189,8 @@
* the array's length is <tt>0</tt>, the name will be
* in the unconstrained scope.
* @return The newly created {@link Name}
+ * @throws ModelConstraintException If either the <tt>value</tt>, or
+ * <tt>scope</tt> is <tt>null</tt>.
*/
public Name createName(String value, Topic... scope);
@@ -200,6 +207,8 @@
* @param scope A collection of themes or <tt>null</tt> if the name should
* be in the unconstrained scope.
* @return The newly created {@link Name}
+ * @throws ModelConstraintException If either the <tt>value</tt>, or
+ * <tt>scope</tt> is <tt>null</tt>.
*/
public Name createName(String value, Collection<Topic> scope);
@@ -232,6 +241,7 @@
* must not be <tt>null</tt>.
* @return An unmodifiable set of {@link Occurrence}s with the
* specified <tt>type</tt>.
+ * @throws IllegalArgumentException If the <tt>type</tt> is <tt>null</tt>.
*/
public Set<Occurrence> getOccurrences(Topic type);
@@ -249,6 +259,8 @@
* the array's length is <tt>0</tt>, the occurrence will be
* in the unconstrained scope.
* @return The newly created {@link Occurrence}.
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, or <tt>scope</tt> is <tt>null</tt>.
*/
public Occurrence createOccurrence(Topic type, String value, Topic... scope);
@@ -265,6 +277,8 @@
* @param scope A collection of themes or <tt>null</tt> if the occurrence
* should be in the unconstrained scope.
* @return The newly created {@link Occurrence}.
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, or <tt>scope</tt> is <tt>null</tt>.
*/
public Occurrence createOccurrence(Topic type, String value,
Collection<Topic> scope);
@@ -283,6 +297,8 @@
* the array's length is <tt>0</tt>, the occurrence will be
* in the unconstrained scope.
* @return The newly created {@link Occurrence}.
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, or <tt>scope</tt> is <tt>null</tt>.
*/
public Occurrence createOccurrence(Topic type, Locator value,
Topic... scope);
@@ -300,6 +316,8 @@
* @param scope A collection of themes or <tt>null</tt> if the occurrence
* should be in the unconstrained scope.
* @return The newly created {@link Occurrence}.
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, or <tt>scope</tt> is <tt>null</tt>.
*/
public Occurrence createOccurrence(Topic type, Locator value,
Collection<Topic> scope);
@@ -319,6 +337,9 @@
* the array's length is <tt>0</tt>, the occurrence will be
* in the unconstrained scope.
* @return The newly created {@link Occurrence}.
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, the <tt>datatype</tt> or <tt>scope</tt> is
+ * <tt>null</tt>.
*/
public Occurrence createOccurrence(Topic type, String value,
Locator datatype, Topic... scope);
@@ -337,6 +358,9 @@
* @param scope A collection of themes or <tt>null</tt> if the occurrence
* should be in the unconstrained scope.
* @return The newly created {@link Occurrence}.
+ * @throws ModelConstraintException If either the <tt>type</tt>, the
+ * <tt>value</tt>, the <tt>datatype</tt> or <tt>scope</tt> is
+ * <tt>null</tt>.
*/
public Occurrence createOccurrence(Topic type, String value,
Locator datatype, Collection<Topic> scope);
@@ -370,6 +394,7 @@
* @param type The type of the {@link Role}s to be returned; must not
* be <tt>null</tt>.
* @return An unmodifiable set of {@link Role}s with the specified <tt>type</tt>.
+ * @throws IllegalArgumentException If the <tt>type</tt> is <tt>null</tt>.
*/
public Set<Role> getRolesPlayed(Topic type);
@@ -396,6 +421,8 @@
* @return An unmodifiable set of {@link Role}s with the specified <tt>type</tt>
* which are part of {@link Association}s with the specified
* <tt>assocType</tt>.
+ * @throws IllegalArgumentException If the <tt>type</tt> or <tt>assocType</tt>
+ * is <tt>null</tt>.
*/
public Set<Role> getRolesPlayed(Topic type, Topic assocType);
@@ -423,6 +450,7 @@
*
* @param type The type of which this topic should become an instance of;
* must not be <tt>null</tt>.
+ * @throws ModelConstraintException If the <tt>type</tt> is <tt>null</tt>.
*/
public void addType(Topic type);
Modified: trunk/src/main/java/org/tmapi/core/TopicMap.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TopicMap.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/TopicMap.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -125,6 +125,7 @@
*
* @param sid The subject identifier the topic should contain.
* @return A {@link Topic} instance with the specified subject identifier.
+ * @throws ModelConstraintException If the subject identifier <tt>sid</tt> is <tt>null</tt>.
*/
public Topic createTopicBySubjectIdentifier(Locator sid);
@@ -137,6 +138,7 @@
*
* @param slo The subject locator the topic should contain.
* @return A {@link Topic} instance with the specified subject locator.
+ * @throws ModelConstraintException If the subject locator <tt>slo</tt> is <tt>null</tt>.
*/
public Topic createTopicBySubjectLocator(Locator slo);
@@ -158,6 +160,9 @@
*
* @param iid The item identifier the topic should contain.
* @return A {@link Topic} instance with the specified item identifier.
+ * @throws ModelConstraintException If the item identifier <tt>iid</tt> is <tt>null</tt>.
+ * @throws IdentityConstraintException If an other {@link Construct} with the
+ * specified item identifier exists which is not a {@link Topic}.
*/
public Topic createTopicByItemIdentifier(Locator iid);
@@ -184,6 +189,8 @@
* the array's length is <tt>0</tt>, the association will be
* in the unconstrained scope.
* @return The newly created {@link Association}
+ * @throws ModelConstraintException If either the <tt>type</tt> or
+ * <tt>scope</tt> is <tt>null</tt>.
*/
public Association createAssociation(Topic type, Topic... scope);
@@ -195,6 +202,8 @@
* @param scope A collection of themes or <tt>null</tt> if the association
* should be in the unconstrained scope.
* @return The newly created {@link Association}
+ * @throws ModelConstraintException If either the <tt>type</tt> or
+ * <tt>scope</tt> is <tt>null</tt>.
*/
public Association createAssociation(Topic type, Collection<Topic> scope);
Modified: trunk/src/main/java/org/tmapi/core/Typed.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Typed.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Typed.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -38,6 +38,7 @@
*
* @param type The topic that should define the nature of this construct;
* MUST NOT be <tt>null</tt>.
+ * @throws ModelConstraintException If the <tt>type</tt> is <tt>null</tt>.
*/
public void setType(Topic type);
Modified: trunk/src/main/java/org/tmapi/core/Variant.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/Variant.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/main/java/org/tmapi/core/Variant.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -38,8 +38,7 @@
*
* The returned scope is a true superset of the parent's scope.
*
- * @return An unmodifiable set of {@link Topic}s which define
- * the scope.
+ * @return An unmodifiable set of {@link Topic}s which define the scope.
*/
public Set<Topic> getScope();
Modified: trunk/src/test/java/org/tmapi/core/TestAssociation.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestAssociation.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestAssociation.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -134,7 +134,7 @@
assoc.getRoles(null);
fail("getRoles(null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -147,7 +147,7 @@
assoc.createRole(createTopic(), null);
fail("Role creation where player is null shouldn't be allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -160,7 +160,7 @@
assoc.createRole(null, createTopic());
fail("Role creation where type is null shouldn't be allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
Modified: trunk/src/test/java/org/tmapi/core/TestConstruct.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestConstruct.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestConstruct.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -51,7 +51,7 @@
construct.addItemIdentifier(null);
fail("addItemIdentifier(null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
if (construct instanceof TopicMap) {
Modified: trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestDatatypeAware.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -238,7 +238,7 @@
dt.setValue("value", null);
fail("datatypeAware.setValue(\"value\", null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -249,7 +249,7 @@
dt.setValue((String)null);
fail("datatypeAware.setValue((String)null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -260,7 +260,7 @@
dt.setValue(null, _xsdString);
fail("datatypeAware.setValue(null, datatype) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -271,7 +271,7 @@
dt.setValue((Locator)null);
fail("datatypeAware.setValue((Locator)null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -282,7 +282,7 @@
dt.setValue((BigInteger)null);
fail("datatypeAware.setValue((BigInteger)null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -293,44 +293,11 @@
dt.setValue((BigDecimal)null);
fail("datatypeAware.setValue((BigDecimal)null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
- public void testIllegalFloatValue() {
- final DatatypeAware dt = getDatatypeAware();
- try {
- dt.setValue((Float)null);
- fail("datatypeAware.setValue((Float)null) is illegal");
- }
- catch (Exception ex) {
- // noop.
- }
- }
-
- public void testIllegalLongValue() {
- final DatatypeAware dt = getDatatypeAware();
- try {
- dt.setValue((Long)null);
- fail("datatypeAware.setValue((Long)null) is illegal");
- }
- catch (Exception ex) {
- // noop.
- }
- }
-
- public void testIllegalIntValue() {
- final DatatypeAware dt = getDatatypeAware();
- try {
- dt.setValue((Integer)null);
- fail("datatypeAware.setValue((Integer)null) is illegal");
- }
- catch (Exception ex) {
- // noop.
- }
- }
-
protected void assertFailInteger(final DatatypeAware dt) {
try {
dt.integerValue();
Modified: trunk/src/test/java/org/tmapi/core/TestName.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestName.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestName.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -59,7 +59,7 @@
name.setValue(null);
fail("setValue(null) is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
// Old value kept.
@@ -108,7 +108,7 @@
name.createVariant((String)null, theme);
fail("Creation of a variant with (String) null value is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -120,7 +120,7 @@
name.createVariant((Locator)null, theme);
fail("Creation of a variant with (Locator) null value is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -132,7 +132,7 @@
name.createVariant("Variant", (Locator)null, theme);
fail("Creation of a variant with datatype == null is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -158,7 +158,7 @@
name.createVariant("Variant", Collections.<Topic>emptySet());
fail("Creation of a variant with an empty scope is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -169,7 +169,7 @@
name.createVariant("Variant", (Topic[])null);
fail("Creation of a variant with a null scope is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
Modified: trunk/src/test/java/org/tmapi/core/TestRole.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestRole.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestRole.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -67,11 +67,15 @@
role.setPlayer(player);
assertEquals("Unexpected role player after setting to 'player'",
player, role.getPlayer());
+ }
+
+ public void testIllegalPlayer() {
+ Role role = createRole();
try {
role.setPlayer(null);
fail("Setting the role player to null is not allowed");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
Modified: trunk/src/test/java/org/tmapi/core/TestScoped.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestScoped.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestScoped.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -58,7 +58,7 @@
scoped.addTheme(null);
fail("addTheme(null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
Modified: trunk/src/test/java/org/tmapi/core/TestTopic.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestTopic.java 2008-08-09 16:08:12 UTC (rev 63)
+++ trunk/src/test/java/org/tmapi/core/TestTopic.java 2008-08-14 11:46:44 UTC (rev 64)
@@ -56,7 +56,7 @@
topic.addSubjectIdentifier(null);
fail("addSubjectIdentifier(null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -67,7 +67,7 @@
topic.addSubjectLocator(null);
fail("addSubjectLocator(null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -124,7 +124,7 @@
topic.addType(null);
fail("addType(null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -161,7 +161,7 @@
player.getRolesPlayed(null);
fail("topic.getRolesPlayed(null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -217,7 +217,7 @@
player.getRolesPlayed(role.getType(), null);
fail("topic.getRolesPlayed(type, null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -229,7 +229,7 @@
player.getRolesPlayed(null, role.getParent().getType());
fail("topic.getRolesPlayed(null, type) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -265,7 +265,7 @@
parent.getOccurrences(null);
fail("topic.getOccurrences(null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -301,7 +301,7 @@
parent.getNames(null);
fail("topic.getNames(null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -505,7 +505,7 @@
topic.createOccurrence(createTopic(), "Occurrence", (Locator)null);
fail("createOccurrence(topic, \"Occurrence\", (Locator)null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -516,7 +516,7 @@
topic.createOccurrence(null, "Occurrence");
fail("createOccurrence(null, \"Occurrence\" is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
// noop.
}
}
@@ -527,7 +527,7 @@
topic.createOccurrence(createTopic(), "Occurrence", (Topic[])null);
fail("createOccurrence(topic, \"Occurrence\", (Topic[])null) is illegal");
}
- catch (Exception ex) {
+ catch (ModelConstraintException ex) {
...
[truncated message content] |
|
From: <bo...@us...> - 2010-09-01 08:48:20
|
Revision: 185
http://tmapi.svn.sourceforge.net/tmapi/?rev=185&view=rev
Author: bosso
Date: 2010-09-01 08:48:13 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
added clear method and testCase; see issue #3056681
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/TopicMap.java
trunk/src/test/java/org/tmapi/core/TestTopicMap.java
Modified: trunk/src/main/java/org/tmapi/core/TopicMap.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TopicMap.java 2010-08-31 14:27:13 UTC (rev 184)
+++ trunk/src/main/java/org/tmapi/core/TopicMap.java 2010-09-01 08:48:13 UTC (rev 185)
@@ -18,6 +18,8 @@
import org.tmapi.index.Index;
+import sun.reflect.generics.visitor.Reifier;
+
/**
* Represents a
* <a href="http://www.isotopicmaps.org/sam/sam-model/#d0e657">topic map item</a>.
@@ -236,6 +238,25 @@
* </p>
*/
public void close();
+
+
+ /**
+ * Clears the topic map.
+ * <p>
+ * All constructs in the topic map will be removed including the {@link Reifier} of the topic map
+ * and all item identifiers of the map.
+ * </p>
+ * <p>
+ * The result is a map which would be equal to:
+ * <code>
+ * final Locator loc = tmSys.createLocator("http://example.org/map");
+ * final TopicMap tm = tmSys.createTopicMap(loc);
+ * tm.remove();
+ * tm = tmSys.createTopicMap(loc);
+ * </code>
+ * </p>
+ */
+ public void clear();
/**
* Merges the topic map <tt>other</tt> into this topic map.
Modified: trunk/src/test/java/org/tmapi/core/TestTopicMap.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestTopicMap.java 2010-08-31 14:27:13 UTC (rev 184)
+++ trunk/src/test/java/org/tmapi/core/TestTopicMap.java 2010-09-01 08:48:13 UTC (rev 185)
@@ -18,6 +18,7 @@
import java.util.Collections;
import org.tmapi.index.Index;
+import org.tmapi.index.LiteralIndex;
/**
* Tests against the {@link TopicMap} interface.
@@ -232,6 +233,70 @@
// noop.
}
}
+
+ public void testClear() {
+ LiteralIndex li = _tm.getIndex(LiteralIndex.class);
+ if (!li.isOpen()) {
+ li.open();
+ }
+
+ // adding some constructs to the topic map
+ _tm.setReifier(_tm.createTopic());
+ assertNotNull(_tm.getReifier());
+
+ _tm.addItemIdentifier(_tm.createLocator("http://tmapi.org/test/topicmap"));
+ assertEquals(1, _tm.getItemIdentifiers().size());
+
+ // create topic with name, variant and occurrence
+ Topic t = _tm.createTopic();
+ assertNotNull(t);
+
+ Name n = t.createName("Test", _tm.createTopic());
+ assertNotNull(n);
+
+ Variant v = n.createVariant("VariantName", _tm.createTopic());
+ assertNotNull(v);
+
+ Occurrence occ = t.createOccurrence(_tm.createTopic(), "TestOccurrence");
+ assertNotNull(occ);
+
+ Association assoc = _tm.createAssociation(_tm.createTopic());
+ assertNotNull(assoc);
+
+ Role r = assoc.createRole(_tm.createTopic(), _tm.createTopic());
+ assertNotNull(r);
+
+
+ // checking the literal index
+ if (!li.isAutoUpdated()) {
+ li.reindex();
+ }
+ assertEquals(1, li.getNames("Test").size());
+ assertEquals(n, li.getNames("Test").iterator().next());
+ assertEquals(1, li.getVariants("VariantName").size());
+ assertEquals(v, li.getVariants("VariantName").iterator().next());
+ assertEquals(1, li.getOccurrences("TestOccurrence").size());
+ assertEquals(occ, li.getOccurrences("TestOccurrence").iterator().next());
+
+ // clear the topic map
+ _tm.clear();
+
+ // check topic map
+ assertEquals(0, _tm.getAssociations().size());
+ assertEquals(0, _tm.getTopics().size());
+ assertEquals(0, _tm.getItemIdentifiers().size());
+ assertNull(_tm.getReifier());
+ assertEquals(_defaultLocator, _tm.getLocator());
+
+ // check index
+ if (!li.isAutoUpdated()) {
+ li.reindex();
+ }
+ assertEquals(0, li.getNames("Test").size());
+ assertEquals(0, li.getVariants("VariantName").size());
+ assertEquals(0, li.getOccurrences("TestOccurrence").size());
+
+ }
/**
* Test index.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lh...@us...> - 2008-08-19 11:14:10
|
Revision: 65
http://tmapi.svn.sourceforge.net/tmapi/?rev=65&view=rev
Author: lheuer
Date: 2008-08-19 11:14:19 +0000 (Tue, 19 Aug 2008)
Log Message:
-----------
- Added IllegalArgumentException to the index docs
- More variant tests
- More ScopedIndex tests
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/index/LiteralIndex.java
trunk/src/main/java/org/tmapi/index/ScopedIndex.java
trunk/src/test/java/org/tmapi/core/TestReified.java
trunk/src/test/java/org/tmapi/core/TestVariant.java
trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java
trunk/src/test/java/org/tmapi/index/TestScopedIndex.java
Modified: trunk/src/main/java/org/tmapi/index/LiteralIndex.java
===================================================================
--- trunk/src/main/java/org/tmapi/index/LiteralIndex.java 2008-08-14 11:46:44 UTC (rev 64)
+++ trunk/src/main/java/org/tmapi/index/LiteralIndex.java 2008-08-19 11:14:19 UTC (rev 65)
@@ -37,6 +37,7 @@
*
* @param value The value of the {@link Occurrence}s to be returned.
* @return An unmodifiable collection of {@link Occurrence}s.
+ * @throws IllegalArgumentException If the value is <tt>null</tt>.
*/
public Collection<Occurrence> getOccurrences(String value);
@@ -53,6 +54,7 @@
*
* @param value The value of the {@link Occurrence}s to be returned.
* @return An unmodifiable collection of {@link Occurrence}s.
+ * @throws IllegalArgumentException If the value is <tt>null</tt>.
*/
public Collection<Occurrence> getOccurrences(Locator value);
@@ -65,6 +67,7 @@
* @param value The value of the {@link Occurrence}s to be returned.
* @param datatype The datatype of the {@link Occurrence}s to be returned.
* @return An unmodifiable collection of {@link Occurrence}s.
+ * @throws IllegalArgumentException If the value or datatype is <tt>null</tt>.
*/
public Collection<Occurrence> getOccurrences(String value, Locator datatype);
@@ -77,6 +80,7 @@
*
* @param value The value of the {@link Variant}s to be returned.
* @return An unmodifiable collection of {@link Variant}s.
+ * @throws IllegalArgumentException If the value is <tt>null</tt>.
*/
public Collection<Variant> getVariants(String value);
@@ -93,6 +97,7 @@
*
* @param value The value of the {@link Variant}s to be returned.
* @return An unmodifiable collection of {@link Variant}s.
+ * @throws IllegalArgumentException If the value is <tt>null</tt>.
*/
public Collection<Variant> getVariants(Locator value);
@@ -105,6 +110,7 @@
* @param value The value of the {@link Variant}s to be returned.
* @param datatype The datatype of the {@link Variant}s to be returned.
* @return An unmodifiable collection of {@link Variant}s.
+ * @throws IllegalArgumentException If the value or datatype is <tt>null</tt>.
*/
public Collection<Variant> getVariants(String value, Locator datatype);
@@ -116,6 +122,7 @@
*
* @param value The value of the {@link Name}s to be returned.
* @return An unmodifiable collection of {@link Name}s.
+ * @throws IllegalArgumentException If the value is <tt>null</tt>.
*/
public Collection<Name> getNames(String value);
Modified: trunk/src/main/java/org/tmapi/index/ScopedIndex.java
===================================================================
--- trunk/src/main/java/org/tmapi/index/ScopedIndex.java 2008-08-14 11:46:44 UTC (rev 64)
+++ trunk/src/main/java/org/tmapi/index/ScopedIndex.java 2008-08-19 11:14:19 UTC (rev 65)
@@ -57,6 +57,7 @@
* must match all <tt>themes</tt>, if <tt>false</tt> one
* theme must be matched at least.
* @return An unmodifiable collection of {@link Association}s.
+ * @throws IllegalArgumentException If <tt>themes</tt> is <tt>null</tt>.
*/
public Collection<Association> getAssociations(Topic[] themes,
boolean matchAll);
@@ -95,6 +96,7 @@
* must match all <tt>themes</tt>, if <tt>false</tt> one
* theme must be matched at least.
* @return An unmodifiable collection of {@link Occurrence}s.
+ * @throws IllegalArgumentException If <tt>themes</tt> is <tt>null</tt>.
*/
public Collection<Occurrence> getOccurrences(Topic[] themes,
boolean matchAll);
@@ -133,6 +135,7 @@
* must match all <tt>themes</tt>, if <tt>false</tt> one
* theme must be matched at least.
* @return An unmodifiable collection of {@link Name}s.
+ * @throws IllegalArgumentException If <tt>themes</tt> is <tt>null</tt>.
*/
public Collection<Name> getNames(Topic[] themes, boolean matchAll);
@@ -155,6 +158,7 @@
* @param theme The {@link Topic} which must be part of the scope. This
* must not be <tt>null</tt>.
* @return An unmodifiable collection of {@link Variant}s.
+ * @throws IllegalArgumentException If <tt>theme</tt> is <tt>null</tt>.
*/
public Collection<Variant> getVariants(Topic theme);
@@ -169,6 +173,7 @@
* must match all <tt>themes</tt>, if <tt>false</tt> one
* theme must be matched at least.
* @return An unmodifiable collection of {@link Variant}s.
+ * @throws IllegalArgumentException If <tt>themes</tt> is <tt>null</tt>.
*/
public Collection<Variant> getVariants(Topic[] themes, boolean matchAll);
Modified: trunk/src/test/java/org/tmapi/core/TestReified.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestReified.java 2008-08-14 11:46:44 UTC (rev 64)
+++ trunk/src/test/java/org/tmapi/core/TestReified.java 2008-08-19 11:14:19 UTC (rev 65)
@@ -45,6 +45,8 @@
assertEquals("Unexpected reifier property", reifier, reifiable.getReifier());
assertEquals("Unexpected reified property", reifiable, reifier.getReified());
try {
+ // Assigning the *same* reifier is allowed, the TM processor MUST NOT
+ // raise an exception
reifiable.setReifier(reifier);
}
catch (ModelConstraintException ex) {
Modified: trunk/src/test/java/org/tmapi/core/TestVariant.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestVariant.java 2008-08-14 11:46:44 UTC (rev 64)
+++ trunk/src/test/java/org/tmapi/core/TestVariant.java 2008-08-19 11:14:19 UTC (rev 65)
@@ -62,7 +62,8 @@
final Topic varTheme = createTopic();
final Variant variant = name.createVariant("Variant", varTheme);
assertNotNull(variant);
- assertEquals(1, variant.getScope().size());
+ assertEquals("Unexpected variant's scope",
+ 1, variant.getScope().size());
assertTrue(variant.getScope().contains(varTheme));
final Topic nameTheme = createTopic();
name.addTheme(nameTheme);
@@ -73,7 +74,62 @@
assertTrue(variant.getScope().contains(varTheme));
name.removeTheme(nameTheme);
assertTrue(name.getScope().isEmpty());
- assertEquals(1, variant.getScope().size());
+ assertEquals("Name's theme wasn't remove from the variant",
+ 1, variant.getScope().size());
assertTrue(variant.getScope().contains(varTheme));
}
+
+ /**
+ * Tests if a variant's theme equals to a name's theme stays
+ * even if the name's theme is removed.
+ */
+ public void testScopeProperty2() {
+ final Topic theme = createTopic();
+ final Topic varTheme = createTopic();
+ final Name name = createTopic().createName("Name", theme);
+ assertEquals(1, name.getScope().size());
+ assertTrue(name.getScope().contains(theme));
+ final Variant variant = name.createVariant("Variant", theme, varTheme);
+ assertNotNull(variant);
+ assertEquals("Unexpected variant's scope",
+ 2, variant.getScope().size());
+ assertTrue(variant.getScope().contains(theme));
+ assertTrue(variant.getScope().contains(varTheme));
+ name.removeTheme(theme);
+ assertEquals(0, name.getScope().size());
+ assertEquals("Unexpected variant's scope after removal of 'theme' from name",
+ 2, variant.getScope().size());
+ assertTrue(variant.getScope().contains(theme));
+ assertTrue(variant.getScope().contains(varTheme));
+ }
+
+ /**
+ * Tests if a variant's theme equals to a name's theme stays
+ * even if the variant's theme is removed.
+ */
+ public void testScopeProperty3() {
+ final Topic theme = createTopic();
+ final Topic varTheme = createTopic();
+ final Name name = createTopic().createName("Name", theme);
+ assertEquals(1, name.getScope().size());
+ assertTrue(name.getScope().contains(theme));
+ final Variant variant = name.createVariant("Variant", theme, varTheme);
+ assertNotNull(variant);
+ assertEquals("Unexpected variant's scope",
+ 2, variant.getScope().size());
+ assertTrue(variant.getScope().contains(theme));
+ assertTrue(variant.getScope().contains(varTheme));
+ variant.removeTheme(theme);
+ assertEquals("The parent still contains 'theme'",
+ 2, variant.getScope().size());
+ assertTrue(variant.getScope().contains(theme));
+ assertTrue(variant.getScope().contains(varTheme));
+ name.removeTheme(theme);
+ assertEquals(0, name.getScope().size());
+ assertEquals("'theme' was removed from the name",
+ 1, variant.getScope().size());
+ assertFalse(variant.getScope().contains(theme));
+ assertTrue(variant.getScope().contains(varTheme));
+ }
+
}
Modified: trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java
===================================================================
--- trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java 2008-08-14 11:46:44 UTC (rev 64)
+++ trunk/src/test/java/org/tmapi/index/TestLiteralIndex.java 2008-08-19 11:14:19 UTC (rev 65)
@@ -91,7 +91,7 @@
_litIdx.getNames(null);
fail("getNames(null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -185,7 +185,7 @@
_litIdx.getOccurrences((String)null);
fail("getOccurrences((String)null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -195,7 +195,7 @@
_litIdx.getOccurrences((Locator)null);
fail("getOccurrences((Locator)null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -205,7 +205,7 @@
_litIdx.getOccurrences("value", null);
fail("getOccurrences(\"value\", null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -299,7 +299,7 @@
_litIdx.getVariants((String)null);
fail("getVariants((String)null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -309,7 +309,7 @@
_litIdx.getVariants((Locator)null);
fail("getVariants((Locator)null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
@@ -319,7 +319,7 @@
_litIdx.getVariants("value", null);
fail("getVariants(\"value\", null) is illegal");
}
- catch (Exception ex) {
+ catch (IllegalArgumentException ex) {
// noop.
}
}
Modified: trunk/src/test/java/org/tmapi/index/TestScopedIndex.java
===================================================================
--- trunk/src/test/java/org/tmapi/index/TestScopedIndex.java 2008-08-14 11:46:44 UTC (rev 64)
+++ trunk/src/test/java/org/tmapi/index/TestScopedIndex.java 2008-08-19 11:14:19 UTC (rev 65)
@@ -176,10 +176,11 @@
final Name name = createName();
assertEquals(0, name.getScope().size());
final Variant scoped = name.createVariant("Variant", theme);
- assertEquals(1, scoped.getScope().size());
+ assertEquals("Unexpected variant's scope size", 1, scoped.getScope().size());
_updateIndex();
assertFalse(_scopedIdx.getVariantThemes().isEmpty());
- assertEquals(1, _scopedIdx.getVariantThemes().size());
+ assertEquals("Unexpected number of variant themes",
+ 1, _scopedIdx.getVariantThemes().size());
assertTrue(_scopedIdx.getVariants(theme).contains(scoped));
assertTrue(_scopedIdx.getVariantThemes().contains(theme));
// Add theme to name
@@ -198,13 +199,14 @@
name.removeTheme(theme2);
_updateIndex();
assertFalse(_scopedIdx.getVariantThemes().isEmpty());
- assertEquals(1, _scopedIdx.getVariantThemes().size());
+ assertEquals("The scope change in the name is not reflected in variant",
+ 1, _scopedIdx.getVariantThemes().size());
assertTrue(_scopedIdx.getVariants(theme).contains(scoped));
assertTrue(_scopedIdx.getVariantThemes().contains(theme));
scoped.addTheme(theme2);
_updateIndex();
assertEquals("Change of the variant's scope is not reflected in the index",
- 2, _scopedIdx.getVariantThemes().size());
+ 2, _scopedIdx.getVariantThemes().size());
assertTrue(_scopedIdx.getVariants(theme).contains(scoped));
assertTrue(_scopedIdx.getVariantThemes().contains(theme));
assertTrue(_scopedIdx.getVariants(theme2).contains(scoped));
@@ -212,7 +214,8 @@
// Add theme to name
name.addTheme(theme2);
_updateIndex();
- assertEquals(2, _scopedIdx.getVariantThemes().size());
+ assertEquals("Adding a theme to the variant's parent is not reflected",
+ 2, _scopedIdx.getVariantThemes().size());
assertTrue(_scopedIdx.getVariants(theme).contains(scoped));
assertTrue(_scopedIdx.getVariantThemes().contains(theme));
assertTrue(_scopedIdx.getVariants(theme2).contains(scoped));
@@ -220,7 +223,8 @@
// Remove theme from name
name.removeTheme(theme2);
_updateIndex();
- assertEquals(2, _scopedIdx.getVariantThemes().size());
+ assertEquals("Removing the name's theme MUST NOT be reflected in the variant's scope",
+ 2, _scopedIdx.getVariantThemes().size());
assertTrue(_scopedIdx.getVariants(theme).contains(scoped));
assertTrue(_scopedIdx.getVariantThemes().contains(theme));
assertTrue(_scopedIdx.getVariants(theme2).contains(scoped));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lh...@us...> - 2009-02-06 16:25:42
|
Revision: 97
http://tmapi.svn.sourceforge.net/tmapi/?rev=97&view=rev
Author: lheuer
Date: 2009-02-06 16:25:36 +0000 (Fri, 06 Feb 2009)
Log Message:
-----------
- Added MalformedIRIException (acc. to vote November 2008)
- Changed ModelConstraintException and IdentityConstraintException: getSender() -> getReporter(), disallow null
- Updated test cases
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java
trunk/src/main/java/org/tmapi/core/ModelConstraintException.java
trunk/src/main/java/org/tmapi/core/TopicInUseException.java
trunk/src/test/java/org/tmapi/core/AbstractTestDatatypeAware.java
trunk/src/test/java/org/tmapi/core/TestItemIdentifierConstraint.java
trunk/src/test/java/org/tmapi/core/TestReifiable.java
trunk/src/test/java/org/tmapi/core/TestTopicRemovableConstraint.java
Added Paths:
-----------
trunk/src/main/java/org/tmapi/core/MalformedIRIException.java
Modified: trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/main/java/org/tmapi/core/IdentityConstraintException.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -34,21 +34,23 @@
* Creates a new <tt>IdentityConstraintException</tt> with the specified
* message.
*
- * @param sender The construct to which the identity should have been assigned to.
+ * @param reporter The construct to which the identity should have been
+ * assigned to. In case a factory method has thrown this
+ * exception, the construct which provides the factory method.
* @param existing The construct which has the same identity.
* @param locator The locator representing the identity.
* @param msg The detail message.
*/
- public IdentityConstraintException(Construct sender, Construct existing,
+ public IdentityConstraintException(Construct reporter, Construct existing,
Locator locator, String msg) {
- super(sender, msg);
+ super(reporter, msg);
_existing = existing;
_locator = locator;
}
/**
- * Returns the {@link Construct} which existed already with the
- * same identity.
+ * Returns the {@link Construct} which already has the identity represented
+ * by the locator {@link #getLocator()}.
*
* @return The existing construct.
*/
@@ -57,9 +59,9 @@
}
/**
- * Returns the locator that caused the exception.
+ * Returns the locator representing the identity that caused the exception.
*
- * @return The locator.
+ * @return A locator representing the identity which has caused the exception.
*/
public Locator getLocator() {
return _locator;
Added: trunk/src/main/java/org/tmapi/core/MalformedIRIException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/MalformedIRIException.java (rev 0)
+++ trunk/src/main/java/org/tmapi/core/MalformedIRIException.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -0,0 +1,36 @@
+/*
+ * The Topic Maps API (TMAPI) was created collectively by
+ * the membership of the tmapi-discuss mailing list
+ * <http://lists.sourceforge.net/mailman/listinfo/tmapi-discuss>,
+ * is hereby released into the public domain; and comes with
+ * NO WARRANTY.
+ *
+ * No one owns TMAPI: you may use it freely in both commercial and
+ * non-commercial applications, bundle it with your software
+ * distribution, include it on a CD-ROM, list the source code in a
+ * book, mirror the documentation at your own web site, or use it in
+ * any other way you see fit.
+ */
+package org.tmapi.core;
+
+/**
+ * Thrown to indicate that a malformed IRI has occurred.
+ *
+ * @author TMAPI <a href="http://www.tmapi.org">tmapi.org</a>
+ * @version $Rev:$ - $Date:$
+ */
+public class MalformedIRIException extends TMAPIRuntimeException {
+
+ private static final long serialVersionUID = 2126925008251115110L;
+
+ /**
+ * Constructs a <tt>MalformedIRIException</tt> with the specified detail
+ * message.
+ *
+ * @param message The detail message.
+ */
+ public MalformedIRIException(String message) {
+ super(message);
+ }
+
+}
Property changes on: trunk/src/main/java/org/tmapi/core/MalformedIRIException.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date Id
Added: svn:eol-style
+ native
Modified: trunk/src/main/java/org/tmapi/core/ModelConstraintException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/ModelConstraintException.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/main/java/org/tmapi/core/ModelConstraintException.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -23,31 +23,29 @@
*/
public class ModelConstraintException extends TMAPIRuntimeException {
- private static final long serialVersionUID = -7515653646384503071L;
+ private static final long serialVersionUID = 7038106692343162395L;
- private final Construct _sender;
+ private final Construct _reporter;
/**
* Creates a new <tt>ModelConstraintException</tt> with the specified
* message.
*
- * @param sender The construct which should have been modified.
+ * @param reporter The construct which has thrown this exception.
* @param msg The detail message.
*/
- public ModelConstraintException(Construct sender, String msg) {
+ public ModelConstraintException(Construct reporter, String msg) {
super(msg);
- _sender = sender;
+ _reporter = reporter;
}
/**
* Returns the {@link Construct} which has thrown the exception.
*
- * @return The construct which has thrown the exception or <tt>null</tt>
- * if no appropriate construct is available (i.e. in the factory
- * methods).
+ * @return The construct which has thrown the exception.
*/
- public Construct getSender() {
- return _sender;
+ public Construct getReporter() {
+ return _reporter;
}
}
Modified: trunk/src/main/java/org/tmapi/core/TopicInUseException.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TopicInUseException.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/main/java/org/tmapi/core/TopicInUseException.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -22,26 +22,25 @@
*/
public class TopicInUseException extends ModelConstraintException {
- private static final long serialVersionUID = 6118893892630188394L;
+ private static final long serialVersionUID = 486617548358575845L;
-
/**
* Creates a new <tt>TopicInUseException</tt> with the specified
* message.
*
- * @param sender The topic which is not removable.
+ * @param topic The topic which is not removable.
* @param msg The detail message.
*/
- public TopicInUseException(Topic sender, String msg) {
- super(sender, msg);
+ public TopicInUseException(Topic topic, String msg) {
+ super(topic, msg);
}
/* (non-Javadoc)
- * @see org.tmapi.core.ModelConstraintException#getSender()
+ * @see org.tmapi.core.ModelConstraintException#getReporter()
*/
@Override
- public Topic getSender() {
- return (Topic) super.getSender();
+ public Topic getReporter() {
+ return (Topic) super.getReporter();
}
}
Modified: trunk/src/test/java/org/tmapi/core/AbstractTestDatatypeAware.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/AbstractTestDatatypeAware.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/test/java/org/tmapi/core/AbstractTestDatatypeAware.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -155,9 +155,8 @@
final DatatypeAware dt = getDatatypeAware();
dt.setValue(value);
final String val = dt.getValue();
- if (!"10".equals(val) && !"10.0".equals(val)) {
- fail("Expected either '10' or the canonical representation '10.0'");
- }
+ assertTrue("Expected either '10' or the canonical representation '10.0'",
+ "10".equals(val) || "10.0".equals(val));
assertEquals(_xsdDecimal, dt.getDatatype());
assertEquals(value, dt.decimalValue());
assertEquals(BigInteger.TEN, dt.integerValue());
@@ -171,9 +170,8 @@
final DatatypeAware dt = getDatatypeAware();
dt.setValue(value.toString(), _xsdDecimal);
final String val = dt.getValue();
- if (!"10".equals(val) && !"10.0".equals(val)) {
- fail("Expected either '10' or the canonical representation '10.0'");
- }
+ assertTrue("Expected either '10' or the canonical representation '10.0'",
+ "10".equals(val) || "10.0".equals(val));
assertEquals(_xsdDecimal, dt.getDatatype());
if (!value.equals(dt.decimalValue()) &&
!new BigDecimal("10.0").equals(dt.decimalValue())) {
Modified: trunk/src/test/java/org/tmapi/core/TestItemIdentifierConstraint.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestItemIdentifierConstraint.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/test/java/org/tmapi/core/TestItemIdentifierConstraint.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -25,7 +25,7 @@
*
* @author <a href="http://tmapi.org/">The TMAPI Project</a>
* @author Lars Heuer (heuer[at]semagia.com) <a href="http://www.semagia.com/">Semagia</a>
- * @version $Rev:$ - $Date:$
+ * @version $Rev$ - $Date$
*/
public class TestItemIdentifierConstraint extends TMAPITestCase {
@@ -50,7 +50,9 @@
fail("Topic Maps constructs with the same item identifier are not allowed");
}
catch (IdentityConstraintException ex) {
- // noop
+ assertEquals(tmo, ex.getReporter());
+ assertEquals(assoc, ex.getExisting());
+ assertEquals(iid, ex.getLocator());
}
tmo.addItemIdentifier(iid2);
assertTrue(tmo.getItemIdentifiers().contains(iid2));
@@ -87,7 +89,9 @@
topic2.addItemIdentifier(iid);
}
catch (IdentityConstraintException ex) {
- // noop.
+ assertEquals(topic2, ex.getReporter());
+ assertEquals(topic, ex.getExisting());
+ assertEquals(iid, ex.getLocator());
}
topic.removeItemIdentifier(iid);
assertFalse(topic.getItemIdentifiers().contains(iid));
Modified: trunk/src/test/java/org/tmapi/core/TestReifiable.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestReifiable.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/test/java/org/tmapi/core/TestReifiable.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -73,7 +73,7 @@
fail("The reifier reifies already another construct");
}
catch (ModelConstraintException ex) {
- assertEquals(reifiable, ex.getSender());
+ assertEquals(reifiable, ex.getReporter());
}
otherReifiable.setReifier(null);
assertNull("Reifier property should be null", otherReifiable.getReifier());
Modified: trunk/src/test/java/org/tmapi/core/TestTopicRemovableConstraint.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestTopicRemovableConstraint.java 2009-01-11 20:30:19 UTC (rev 96)
+++ trunk/src/test/java/org/tmapi/core/TestTopicRemovableConstraint.java 2009-02-06 16:25:36 UTC (rev 97)
@@ -45,7 +45,7 @@
fail("The topic is used as type");
}
catch (TopicInUseException ex) {
- assertEquals(topic, ex.getSender());
+ assertEquals(topic, ex.getReporter());
}
assertEquals(topicCount+1, _tm.getTopics().size());
typed.setType(oldType);
@@ -69,7 +69,7 @@
fail("The topic is used as theme");
}
catch (TopicInUseException ex) {
- assertEquals(topic, ex.getSender());
+ assertEquals(topic, ex.getReporter());
}
assertEquals(topicCount+1, _tm.getTopics().size());
scoped.removeTheme(topic);
@@ -94,7 +94,7 @@
fail("The topic is used as reifier");
}
catch (TopicInUseException ex) {
- assertEquals(topic, ex.getSender());
+ assertEquals(topic, ex.getReporter());
}
assertEquals(topicCount+1, _tm.getTopics().size());
reifiable.setReifier(null);
@@ -214,7 +214,7 @@
fail("The topic is used as topic type");
}
catch (TopicInUseException ex) {
- assertEquals(topic, ex.getSender());
+ assertEquals(topic, ex.getReporter());
}
assertEquals(2, _tm.getTopics().size());
topic2.removeType(topic);
@@ -242,7 +242,7 @@
fail("The topic is used as player");
}
catch (TopicInUseException ex) {
- assertEquals(topic, ex.getSender());
+ assertEquals(topic, ex.getReporter());
}
role.setPlayer(createTopic());
assertEquals(4, _tm.getTopics().size());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <bo...@us...> - 2010-03-10 12:19:27
|
Revision: 172
http://tmapi.svn.sourceforge.net/tmapi/?rev=172&view=rev
Author: bosso
Date: 2010-03-10 12:18:40 +0000 (Wed, 10 Mar 2010)
Log Message:
-----------
added "getLocator" into the topic map
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/TopicMap.java
trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java
Modified: trunk/src/main/java/org/tmapi/core/TopicMap.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TopicMap.java 2010-03-09 09:35:32 UTC (rev 171)
+++ trunk/src/main/java/org/tmapi/core/TopicMap.java 2010-03-10 12:18:40 UTC (rev 172)
@@ -44,6 +44,13 @@
public Set<Topic> getTopics();
/**
+ * Returns the {@link Locator} that was used to create the topic map.
+ *
+ * @return A {@link Locator}.
+ */
+ public Locator getLocator();
+
+ /**
* Returns all {@link Association}s contained in this topic map.
*
* The return value may be empty but must never be <tt>null</tt>.
Modified: trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java 2010-03-09 09:35:32 UTC (rev 171)
+++ trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java 2010-03-10 12:18:40 UTC (rev 172)
@@ -71,5 +71,21 @@
final Locator loc = _sys.createLocator(ref);
assertEquals(ref, loc.getReference());
}
+
+ public void testTopicMapLocator() {
+ final String ref = "http://www.tmapi.org/";
+ final Locator loc = _sys.createLocator(ref+"2");
+ try {
+ TopicMap tm = _sys.createTopicMap(ref);
+ assertEquals(ref, tm.getLocator().getReference());
+ tm.close();
+
+ tm = _sys.createTopicMap(loc);
+ assertEquals(loc, tm.getLocator());
+ tm.close();
+ } catch (TopicMapExistsException e) {
+ fail("An exception was thrown while creating the topic map");
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lh...@us...> - 2010-03-10 13:02:30
|
Revision: 173
http://tmapi.svn.sourceforge.net/tmapi/?rev=173&view=rev
Author: lheuer
Date: 2010-03-10 13:02:21 +0000 (Wed, 10 Mar 2010)
Log Message:
-----------
* Simplified test
* Added further Java Docs
Modified Paths:
--------------
trunk/src/main/java/org/tmapi/core/TopicMap.java
trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java
Modified: trunk/src/main/java/org/tmapi/core/TopicMap.java
===================================================================
--- trunk/src/main/java/org/tmapi/core/TopicMap.java 2010-03-10 12:18:40 UTC (rev 172)
+++ trunk/src/main/java/org/tmapi/core/TopicMap.java 2010-03-10 13:02:21 UTC (rev 173)
@@ -45,8 +45,15 @@
/**
* Returns the {@link Locator} that was used to create the topic map.
+ * <p>
+ * Note: The returned locator represents the storage address of the topic map
+ * and implies no further semantics.
+ * </p>
+ *
+ * @see org.tmapi.core.TopicMapSystem#createTopicMap(org.tmapi.core.Locator)
+ * @see org.tmapi.core.TopicMapSystem#getTopicMap(org.tmapi.core.Locator)
*
- * @return A {@link Locator}.
+ * @return A {@link Locator}, never {@code null}.
*/
public Locator getLocator();
Modified: trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java
===================================================================
--- trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java 2010-03-10 12:18:40 UTC (rev 172)
+++ trunk/src/test/java/org/tmapi/core/TestTopicMapSystem.java 2010-03-10 13:02:21 UTC (rev 173)
@@ -72,20 +72,15 @@
assertEquals(ref, loc.getReference());
}
- public void testTopicMapLocator() {
+ public void testTopicMapLocator() throws Exception {
final String ref = "http://www.tmapi.org/";
final Locator loc = _sys.createLocator(ref+"2");
- try {
- TopicMap tm = _sys.createTopicMap(ref);
- assertEquals(ref, tm.getLocator().getReference());
- tm.close();
-
- tm = _sys.createTopicMap(loc);
- assertEquals(loc, tm.getLocator());
- tm.close();
- } catch (TopicMapExistsException e) {
- fail("An exception was thrown while creating the topic map");
- }
+ TopicMap tm = _sys.createTopicMap(ref);
+ assertEquals(ref, tm.getLocator().getReference());
+ tm.close();
+ tm = _sys.createTopicMap(loc);
+ assertEquals(loc, tm.getLocator());
+ tm.close();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|