You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/06 11:10:34 UTC
[11/51] [partial] ISIS-188: moving modules into core
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/DomainGenericObjectContainer.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/DomainGenericObjectContainer.java b/framework/applib/src/main/src-archived/DomainGenericObjectContainer.java
deleted file mode 100644
index 34bafe0..0000000
--- a/framework/applib/src/main/src-archived/DomainGenericObjectContainer.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.applib.generics;
-
-import org.apache.isis.applib.security.UserMemento;
-
-
-/**
- * Represents a container that the domain objects work within. It provides access to the persistence mechanism
- * and user interface.
- */
-public interface DomainGenericObjectContainer {
-
- //////////////////////// resolve, objectChanged //////////////////////////
-
- /**
- * Ensure that the specified object is completely loaded into memory.
- *
- * <p>
- * This forces the lazy loading mechanism to load the object if it is not already loaded.
- */
- void resolve(Object object);
-
- /**
- * Ensure that the specified object is completely loaded into memory, though only if the supplied field
- * reference is <tt>null</tt>.
- *
- * <p>
- * This forces the lazy loading mechanism to load the object if it is not already loaded.
- */
- void resolve(Object object, Object field);
-
- /**
- * Flags that the specified object's state has changed and its changes need to be saved.
- */
- void objectChanged(Object object);
-
-
- //////////////////////// new{Transient/Persistent}Instance //////////////////////////
-
- /**
- * Create a new instance of the specified class, but do not persist it.
- *
- * @see #newPersistentInstance(Class)
- */
- <T> T newTransientInstance(Class<T> ofClass);
-
- /**
- * Create a new instance of the specified class and persist it.
- *
- * @see #newTransientInstance(Class)
- */
- <T> T newPersistentInstance(Class<T> ofClass);
-
- /**
- * Create a new instance, of the specified class, in the same persistent state as the specified object.
- *
- * @see #newTransientInstance()
- * @see #newPersistentInstance()
- */
- <T> T newInstance(Class<T> ofClass, Object sameStateAs);
-
-
- //////////////////////// isPersistent, makePersistent, disposeInstance //////////////////////////
-
- /**
- * Determines if the specified object is persistent; that is is stored permanently outside of the virtual
- * machine.
- */
- boolean isPersistent(Object object);
-
- /**
- * Make the specified transient object persistent. Throws an exception if object is already persistent.
- */
- void makePersistent(Object transientObject);
-
- void disposeInstance(Object persistentObject);
-
-
-
- //////////////////////// info, warn, error //////////////////////////
-
- /**
- * Make the specified message available to the user. Note this will probably be displayed in transitory
- * fashion, so is only suitable for useful but optional information.
- *
- * @see #warnUser(String)
- * @see #raiseError(String)
- */
- void informUser(String message);
-
- /**
- * Warn the user about a situation with the specified message. The container should guarantee to display
- * this warning to the user.
- *
- * @see #raiseError(String)
- * @see #informUser(String)
- */
- void warnUser(String message);
-
- /**
- * Notify the user of an application error with the specified message. Note this will probably be
- * displayed in an alarming fashion, so is only suitable for errors
- *
- * @see #warnUser(String)
- * @see #informUser(String)
- */
- void raiseError(String message);
-
-
- //////////////////////// security //////////////////////////
-
- /**
- * Get the details about the current user.
- */
- UserMemento getUser();
-
-
-
- //////////// allInstances, findInstances, findInstance, firstInstance ///////////////////
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T[] allInstances(Class<T> cls, boolean includeSubclasses);
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T[] findInstances(Class<T> cls, String title, boolean includeSubclasses);
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T[] findInstances(Class<T> cls, Object pattern, boolean includeSubclasses);
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T findInstance(Class<T> cls, String title, boolean includeSubclasses);
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T findInstance(Class<T> cls, Object pattern, boolean includeSubclasses);
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T firstInstance(Class<T> cls, String title, boolean includeSubclasses);
-
- /**
- * Use of this method is discouraged; instead use a repository.
- */
- <T> T firstInstance(Class<T> cls, Object pattern, boolean includeSubclasses);
-
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/annotations/BusinessKey.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/annotations/BusinessKey.java b/framework/applib/src/main/src-archived/annotations/BusinessKey.java
deleted file mode 100644
index 240ab91..0000000
--- a/framework/applib/src/main/src-archived/annotations/BusinessKey.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-
-/**
- * Indicates that the attribute is an alternate key or a
- * part of an business key (sometimes called alternate key).
- *
- * <p>
- * Not yet supported.
- */
-@Inherited
-@Target( { ElementType.METHOD })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface BusinessKey {
-
- String value() default "";
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/annotations/Cached.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/annotations/Cached.java b/framework/applib/src/main/src-archived/annotations/Cached.java
deleted file mode 100644
index 8564c99..0000000
--- a/framework/applib/src/main/src-archived/annotations/Cached.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates the instances for this class should be cached.
- *
- * <p>
- * Not yet supported.
- */
-@Inherited
-@Target({ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Cached {
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/annotations/Searchable.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/annotations/Searchable.java b/framework/applib/src/main/src-archived/annotations/Searchable.java
deleted file mode 100644
index fef7376..0000000
--- a/framework/applib/src/main/src-archived/annotations/Searchable.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-
-/**
- * Indicates that the attribute is an alternate key or a part of an business key (sometimes called alternate key).
- * Eg
- * @Searchable(repository=AbstractFactoryAndRepository.class, queryByExample=false)
- * <p>
- * Not yet implemented.
- */
-@Inherited
-@Target( { ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Searchable {
-
- Class repository() default AbstractFactoryAndRepository.class;
-
- boolean queryByExample() default true;
-}
-
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/interfaces/Aggregated.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/interfaces/Aggregated.java b/framework/applib/src/main/src-archived/interfaces/Aggregated.java
deleted file mode 100644
index 736804f..0000000
--- a/framework/applib/src/main/src-archived/interfaces/Aggregated.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.applib;
-
-/**
- * @deprecated - use {@link org.apache.isis.applib.annotation.Aggregated} annotation instead.
- */
-public interface Aggregated {
- Object getAggregate();
-}
-
-
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/interfaces/Cached.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/interfaces/Cached.java b/framework/applib/src/main/src-archived/interfaces/Cached.java
deleted file mode 100644
index d8330ea..0000000
--- a/framework/applib/src/main/src-archived/interfaces/Cached.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.applib;
-
-/**
- * Marker interface to indicate that a class's instances can be cached.
- *
- * <p>
- * @deprecated - replaced by {@link org.apache.isis.applib.annotation.Cached} annotation.
- */
-public interface Cached {}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java b/framework/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java
deleted file mode 100644
index 80fc588..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/BusinessValueHolder.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.BusinessObject;
-import org.apache.isis.application.Title;
-import org.apache.isis.application.TitledObject;
-import org.apache.isis.application.value.ValueParseException;
-
-
-public abstract class BusinessValueHolder implements TitledObject {
-
- protected BusinessValueHolder(final BusinessObject parent) {
- this.parent = parent;
- }
-
- /** The parent which owns this value */
- private BusinessObject parent;
-
- public BusinessObject getParent() {
- return parent;
- }
-
- /**
- * Invokes <code>objectChanged()</code> on parent, provided that parent has been specified (is not
- * <code>nothing</code>).
- */
- protected void parentChanged() {
- if (this.getParent() == null) {
- return;
- }
- this.getParent().objectChanged();
- }
-
- protected void ensureAtLeastPartResolved() {
- }
-
- /** By default all values are changeable by the user */
- public boolean userChangeable() {
- return true;
- }
-
- public abstract boolean isEmpty();
-
- public abstract boolean isSameAs(final BusinessValueHolder object);
-
- public String titleString() {
- return title().toString();
- }
-
- public abstract Title title();
-
- /**
- * Returns a string representation of this object.
- * <p>
- * The specification of this string representation is not fixed, but, at the time of writing, consists of
- * <i>title [short ObjectAdapterClassName] </i>
- * </p>
- *
- * @return string representation of object.
- */
- public String toString() {
- return titleString(); // + " [" + this.getClass().getName() + "]";
- }
-
- public Object getValue() {
- return this;
- }
-
- public abstract void parseUserEntry(final String text) throws ValueParseException;
-
- public abstract void restoreFromEncodedString(final String data);
-
- public abstract String asEncodedString();
-
- public abstract void copyObject(final BusinessValueHolder object);
-
- public abstract void clear();
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/Case.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/Case.java b/framework/applib/src/main/src-archived/old-valueholders/Case.java
deleted file mode 100644
index 4cdd9af..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/Case.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-public class Case {
- public static final Case INSENSITIVE = new Case("insensitive");
-
- public static final Case SENSITIVE = new Case("sensitive");
- private String name;
-
- private Case(final String name) {
- this.name = name;
- }
-
- public String toString() {
- return name;
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/Color.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/Color.java b/framework/applib/src/main/src-archived/old-valueholders/Color.java
deleted file mode 100644
index c07dba4..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/Color.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.BusinessObject;
-import org.apache.isis.application.Title;
-import org.apache.isis.application.value.ValueParseException;
-
-
-public class Color extends Magnitude {
- private int color;
- private boolean isNull;
-
- public Color() {
- this(null);
- }
-
- public Color(final int color) {
- this(null, color);
- }
-
- public Color(final BusinessObject parent) {
- super(parent);
- clear();
- }
-
- public Color(final BusinessObject parent, final int color) {
- super(parent);
- setValue(color);
- }
-
- public void clear() {
- setValuesInternal(0, true, true);
- }
-
- public void copyObject(final BusinessValueHolder object) {
- if (object == null) {
- this.clear();
- } else if (!(object instanceof Color)) {
- throw new IllegalArgumentException("Can only copy the value of a Color object");
- } else {
- setValue((Color) object);
- }
- }
-
- public int intValue() {
- this.ensureAtLeastPartResolved();
- return color;
- }
-
- public boolean isEmpty() {
- this.ensureAtLeastPartResolved();
- return isNull;
- }
-
- /**
- * returns true if the number of this object has the same value as the specified number
- */
- public boolean isEqualTo(final Magnitude number) {
- this.ensureAtLeastPartResolved();
- if (number instanceof Color) {
- if (isNull) {
- return number.isEmpty();
- }
- return ((Color) number).color == color;
- } else {
- throw new IllegalArgumentException("Parameter must be of type Color");
- }
- }
-
- /**
- * Returns true if this value is less than the specified value.
- */
- public boolean isLessThan(final Magnitude value) {
- this.ensureAtLeastPartResolved();
- if (value instanceof Color) {
- return !isNull && !value.isEmpty() && color < ((Color) value).color;
- } else {
- throw new IllegalArgumentException("Parameter must be of type Color");
- }
- }
-
- public void parseUserEntry(final String text) throws ValueParseException {
- if (text == null || text.trim().equals("")) {
- clear();
- } else {
- try {
- if (text.startsWith("0x")) {
- setValue(Integer.parseInt(text.substring(2), 16));
- } else if (text.startsWith("#")) {
- setValue(Integer.parseInt(text.substring(1), 16));
- } else {
- setValue(Integer.parseInt(text));
- }
- } catch (NumberFormatException e) {
- throw new ValueParseException("Invalid number", e);
- }
- }
- }
-
- public void reset() {
- setValuesInternal(0, false, true);
- }
-
- public void restoreFromEncodedString(final String data) {
- if (data == null || data.equals("NULL")) {
- setValuesInternal(0, true, false);
- } else {
- setValuesInternal(Integer.valueOf(data).intValue(), false, false);
- }
- }
-
- public String asEncodedString() {
- // note: isEmpty does this.ensureAtLeastPartResolved();
- if (isEmpty()) {
- return "NULL";
- } else {
- return String.valueOf(intValue());
- }
- }
-
- public void setValue(final Color value) {
- if (value.isEmpty()) {
- clear();
- } else {
- setValuesInternal(value.intValue(), value.isNull, true);
- }
- }
-
- public void setValue(final int color) {
- setValuesInternal(color, false, true);
- }
-
- private void setValuesInternal(final int color, final boolean isNull, final boolean notify) {
- if (notify) {
- ensureAtLeastPartResolved();
- }
- this.color = color;
- this.isNull = isNull;
- if (notify) {
- parentChanged();
- }
- }
-
- public Title title() {
- this.ensureAtLeastPartResolved();
- if (color == 0) {
- return new Title("Black");
- } else if (color == 0xffffff) {
- return new Title("White");
- } else {
- return new Title("0x" + Integer.toHexString(color));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/ColorTest.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/ColorTest.java b/framework/applib/src/main/src-archived/old-valueholders/ColorTest.java
deleted file mode 100644
index fc7f6f8..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/ColorTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.easymock.MockControl;
-import org.apache.isis.application.BusinessObject;
-
-
-public class ColorTest extends ValueTestCase {
-
- public void testEncodedString() {
- MockControl control = MockControl.createControl(BusinessObject.class);
- BusinessObject bo = (BusinessObject) control.getMock();
- bo.objectChanged();
- control.replay(); // finished recording
-
- Color color = new Color(bo);
- assertEquals("enc", "NULL", color.asEncodedString());
-
- control.verify();
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/Date.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/Date.java b/framework/applib/src/main/src-archived/old-valueholders/Date.java
deleted file mode 100644
index 84b9d3a..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/Date.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.ApplicationException;
-import org.apache.isis.application.BusinessObject;
-import org.apache.isis.application.Clock;
-import org.apache.isis.application.Title;
-import org.apache.isis.application.value.ValueParseException;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-
-
-/**
- * Value object representing a date, time, or datestamp value.
- * <p>
- * This object <i>does </i> support value listeners.
- * </p>
- */
-
-/*
- * other methods to implement comparision methods
- *
- * sameDateAs() day == day & mont == month & year == year
- *
- * withinNextDatePeriod(int days, int months, int years) withinDatePeriod(int days, int months, int years)
- * withinPreviousDatePeriod(int days, int months, int years)
- */
-public class Date extends Magnitude {
- private static Clock clock;
- private static final DateFormat ISO_LONG = new SimpleDateFormat("yyyy-MM-dd");
- private static final DateFormat ISO_SHORT = new SimpleDateFormat("yyyyMMdd");
- private static final DateFormat LONG_FORMAT = DateFormat.getDateInstance(DateFormat.LONG);
- private static final DateFormat MEDIUM_FORMAT = DateFormat.getDateInstance(DateFormat.MEDIUM);
- private static final long serialVersionUID = 1L;
- private static final DateFormat SHORT_FORMAT = DateFormat.getDateInstance(DateFormat.SHORT);
-
- public static void setClock(final Clock clock) {
- Date.clock = clock;
-
- ISO_LONG.setLenient(false);
- ISO_SHORT.setLenient(false);
- LONG_FORMAT.setLenient(false);
- MEDIUM_FORMAT.setLenient(false);
- SHORT_FORMAT.setLenient(false);
- }
-
- private java.util.Date date;
- private boolean isNull = true;
-
- /*
- * Create a Date object for storing a date. The date is set to today's date.
- */
- public Date() {
- this((BusinessObject) null);
- }
-
- /*
- * Create a Date object for storing a date with the date set to the specified date.
- */
- public Date(final Date date) {
- // this.date = date.date;
- // isNull = date.isNull;
- this(null, date);
- }
-
- /*
- * Create a Date object for storing a date with the time set to the specified day, month and year.
- */
- public Date(final int year, final int month, final int day) {
- this(null, year, month, day);
- // isNull = false; // moved to set(Calendar) - called by setDate()
- }
-
- /*
- * Create a Date object for storing a date. The date is set to today's date.
- */
- public Date(final BusinessObject parent) {
- super(parent);
- today();
- }
-
- /*
- * Create a Date object for storing a date with the date set to the specified date.
- */
- public Date(final BusinessObject parent, final Date date) {
- // this.date = date.date;
- // isNull = date.isNull;
- super(parent);
- setValue(date);
- }
-
- /*
- * Create a Date object for storing a date with the time set to the specified day, month and year.
- */
- public Date(final BusinessObject parent, final int year, final int month, final int day) {
- super(parent);
- setValue(year, month, day);
- // isNull = false; // moved to set(Calendar) - called by setDate()
- }
-
- /**
- * Add the specified days, years and months to this date value.
- */
- public void add(final int years, final int months, final int days) {
- Calendar cal = Calendar.getInstance();
-
- cal.setTime(date);
- cal.add(Calendar.DAY_OF_MONTH, days);
- cal.add(Calendar.MONTH, months);
- cal.add(Calendar.YEAR, years);
- set(cal);
- }
-
- public Calendar calendarValue() {
- this.ensureAtLeastPartResolved();
- if (isNull) {
- return null;
- }
-
- Calendar c = Calendar.getInstance();
- c.setTime(date);
-
- return c;
- }
-
- private void checkDate(final int year, final int month, final int day) {
- if ((month < 1) || (month > 12)) {
- throw new IllegalArgumentException("Month must be in the range 1 - 12 inclusive");
- }
-
- Calendar cal = Calendar.getInstance();
-
- cal.set(year, month - 1, 0);
-
- int lastDayOfMonth = cal.getMaximum(Calendar.DAY_OF_MONTH);
-
- if ((day < 1) || (day > lastDayOfMonth)) {
- throw new IllegalArgumentException("Day must be in the range 1 - " + lastDayOfMonth + " inclusive: " + day);
- }
- }
-
- public void clear() {
- setValuesInternal(date, true, true);
- }
-
- /**
- * clear all aspects of the time that are not used
- */
- private void clearDate(final Calendar cal) {
- cal.set(Calendar.HOUR, 0);
- cal.set(Calendar.HOUR_OF_DAY, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.AM_PM, 0);
- cal.set(Calendar.MILLISECOND, 0);
- }
-
- public void copyObject(final BusinessValueHolder object) {
- if (!(object instanceof Date)) {
- throw new IllegalArgumentException("Can only copy the value of a Date object");
- }
- setValue((Date) object);
- }
-
- public java.util.Date dateValue() {
- this.ensureAtLeastPartResolved();
- return isNull ? null : date;
- }
-
- public boolean equals(final Object obj) {
- this.ensureAtLeastPartResolved();
- if (obj instanceof Date) {
- Date d = (Date) obj;
- return d.date.equals(date);
- }
- return super.equals(obj);
- }
-
- public int getDay() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.DAY_OF_MONTH);
- }
-
- public int getMonth() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.MONTH) + 1;
- }
-
- public int getYear() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.YEAR);
- }
-
- /**
- * Return true if the date is blank
- */
- public boolean isEmpty() {
- this.ensureAtLeastPartResolved();
- return isNull;
- }
-
- /**
- * returns true if the date of this object has the same value as the specified date
- */
- public boolean isEqualTo(final Magnitude date) {
- this.ensureAtLeastPartResolved();
- if (date instanceof Date) {
- if (isNull) {
- return date.isEmpty();
- }
-
- return this.date.equals(((Date) date).date);
- } else {
- throw new IllegalArgumentException("Parameter must be of type Time");
- }
- }
-
- /**
- * returns true if the time of this object is earlier than the specified time
- */
- public boolean isLessThan(final Magnitude date) {
- this.ensureAtLeastPartResolved();
- if (date instanceof Date) {
- return !isNull && !date.isEmpty() && this.date.before(((Date) date).date);
- } else {
- throw new IllegalArgumentException("Parameter must be of type Time");
- }
- }
-
- /**
- * Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this date.
- */
- public long longValue() {
- this.ensureAtLeastPartResolved();
- return date.getTime();
- }
-
- public void parseUserEntry(final String dateStr) throws ValueParseException {
- String dateString = dateStr.trim();
-
- if (dateString.equals("")) {
- clear();
- } else {
- String str = dateString.toLowerCase();
- Calendar cal = Calendar.getInstance();
- cal.setTime(date);
- clearDate(cal);
-
- if (str.equals("today") || str.equals("now")) {
- today();
- return;
- } else if (str.startsWith("+")) {
- int days;
-
- // support for +1, +1d, +1w, +1m
- int unit = Calendar.DATE;
- int multiplier = 1;
- if (str.endsWith("w")) {
- multiplier = 7;
- str = str.substring(0, str.length() - 1);
- } else if (str.endsWith("m")) {
- unit = Calendar.MONTH;
- str = str.substring(0, str.length() - 1);
- }
-
- days = Integer.valueOf(str.substring(1)).intValue();
- cal.setTime(date);
- cal.add(unit, days * multiplier);
-
- } else if (str.startsWith("-")) {
- int days;
-
- // support for +1, +1d, +1w, +1m
- int unit = Calendar.DATE;
- int multiplier = 1;
- if (str.endsWith("w")) {
- multiplier = 7;
- str = str.substring(0, str.length() - 1);
- } else if (str.endsWith("m")) {
- unit = Calendar.MONTH;
- str = str.substring(0, str.length() - 1);
- }
-
- days = Integer.valueOf(str.substring(1)).intValue();
- cal.setTime(date);
- cal.add(unit, -days * multiplier);
-
- } else {
- DateFormat[] formats = new DateFormat[] { LONG_FORMAT, MEDIUM_FORMAT, SHORT_FORMAT, ISO_LONG, ISO_SHORT };
-
- for (int i = 0; i < formats.length; i++) {
- try {
- cal.setTime(formats[i].parse(dateString));
- break;
- } catch (ParseException e) {
- if ((i + 1) == formats.length) {
- throw new ValueParseException("Invalid date " + dateString, e);
- }
- }
- }
-
- }
-
- set(cal);
- }
- }
-
- public void readExternal(final java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException {
- isNull = in.readBoolean();
- date.setTime(in.readLong());
- }
-
- /**
- * Reset this date so it contains the current date.
- *
- *
- */
- public void reset() {
- today();
- }
-
- public void restoreFromEncodedString(final String data) {
- if (data.equals("NULL")) {
- setValuesInternal(date, true, false);
- } else {
- int year = Integer.valueOf(data.substring(0, 4)).intValue();
- int month = Integer.valueOf(data.substring(4, 6)).intValue();
- int day = Integer.valueOf(data.substring(6)).intValue();
- setValuesInternal(year, month, day, false);
- }
- }
-
- private boolean sameAs(final Date as, final int field) {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
-
- Calendar c2 = Calendar.getInstance();
- c2.setTime(as.date);
-
- return c.get(field) == c2.get(field);
- }
-
- public boolean sameDayAs(final Date as) {
- return sameAs(as, Calendar.DAY_OF_YEAR);
- }
-
- public boolean sameMonthAs(final Date as) {
- return sameAs(as, Calendar.MONTH);
- }
-
- public boolean sameWeekAs(final Date as) {
- return sameAs(as, Calendar.WEEK_OF_YEAR);
- }
-
- public boolean sameYearAs(final Date as) {
- return sameAs(as, Calendar.YEAR);
- }
-
- public String asEncodedString() {
- // note: isEmpty does this.ensureAtLeastPartResolved();
- if (isEmpty()) {
- return "NULL";
- } else {
- Calendar cal = calendarValue();
- StringBuffer data = new StringBuffer(8);
- String year = String.valueOf(cal.get(Calendar.YEAR));
- data.append("0000".substring(0, 4 - year.length()));
- data.append(year);
-
- int month = cal.get(Calendar.MONTH) + 1;
- data.append((month <= 9) ? "0" : "");
- data.append(month);
-
- int day = cal.get(Calendar.DAY_OF_MONTH);
- data.append((day <= 9) ? "0" : "");
- data.append(day);
-
- return data.toString();
- }
- }
-
- private void set(final Calendar cal) {
- setValuesInternal(cal.getTime(), false, true);
- }
-
- private void setValuesInternal(final java.util.Date date, final boolean isNull, final boolean notify) {
- if (notify) {
- ensureAtLeastPartResolved();
- }
- this.date = date;
- this.isNull = isNull;
- if (notify) {
- parentChanged();
- }
- }
-
- private void setValuesInternal(final int year, final int month, final int day, final boolean notify) {
- checkDate(year, month, day);
-
- Calendar cal = Calendar.getInstance();
- clearDate(cal);
- cal.set(year, month - 1, day);
- setValuesInternal(cal.getTime(), false, notify);
- }
-
- public void setValue(final Date date) {
- if (date == null || date.isEmpty()) {
- clear();
- } else {
- setValuesInternal(new java.util.Date(date.longValue()), false, true);
- }
- }
-
- /**
- * Sets this object's date to be the same as the specified day, month and year.
- */
- public void setValue(final int year, final int month, final int day) {
- setValuesInternal(year, month, day, true);
- }
-
- public void setValue(final java.util.Date date) {
- if (date == null) {
- clear();
- } else {
- Calendar cal = Calendar.getInstance();
-
- cal.setTime(date);
- cal.set(Calendar.HOUR, 0);
- cal.set(Calendar.MINUTE, 0);
- cal.set(Calendar.SECOND, 0);
- cal.set(Calendar.MILLISECOND, 0);
- set(cal);
- }
- }
-
- public Title title() {
- this.ensureAtLeastPartResolved();
- return new Title(isNull ? "" : MEDIUM_FORMAT.format(date));
- }
-
- /**
- * Sets this date value to todays date
- */
- public void today() {
- Calendar cal = Calendar.getInstance();
-
- if (clock == null) {
- throw new ApplicationException("Clock not set up");
- }
- long time = clock.getTime();
- java.util.Date d = new java.util.Date(time);
- cal.setTime(d);
-
- clearDate(cal);
- set(cal);
- }
-
- public void toStartOfMonth() {
- Calendar c = Calendar.getInstance();
- c.setTime(date);
-
- c.set(Calendar.MONTH, c.getMinimum(Calendar.MONTH));
- date = c.getTime();
- }
-
- public void toStartOfWeek() {
- Calendar c = Calendar.getInstance();
- c.setTime(date);
-
- c.set(Calendar.DAY_OF_WEEK_IN_MONTH, c.getMinimum(Calendar.DAY_OF_WEEK_IN_MONTH));
- date = c.getTime();
- }
-
- public void toStartOfYear() {
- Calendar c = Calendar.getInstance();
- c.setTime(date);
-
- c.set(Calendar.DAY_OF_YEAR, c.getMinimum(Calendar.DAY_OF_YEAR));
- date = c.getTime();
- }
-
- // sdm update
- public boolean isAfterToday(final Date d) {
- return isGreaterThan(new Date());
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/DatePeriod.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/DatePeriod.java b/framework/applib/src/main/src-archived/old-valueholders/DatePeriod.java
deleted file mode 100644
index 4bd6220..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/DatePeriod.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.BusinessObject;
-import org.apache.isis.application.Title;
-import org.apache.isis.application.value.ValueParseException;
-
-
-public class DatePeriod extends BusinessValueHolder {
- private final Date end = new Date();
- private final Date start = new Date();
-
- public DatePeriod() {
- this((BusinessObject) null);
- }
-
- public DatePeriod(final DatePeriod period) {
- this(null, period);
- }
-
- public DatePeriod(final BusinessObject parent) {
- super(parent);
- clear();
- }
-
- public DatePeriod(final BusinessObject parent, final DatePeriod period) {
- super(parent);
- this.start.copyObject(period.start);
- this.end.copyObject(period.end);
- }
-
- public void clear() {
- clearInternal(true);
- }
-
- private void clearInternal(final boolean notify) {
- if (notify) {
- ensureAtLeastPartResolved();
- }
- start.clear();
- end.clear();
- if (notify) {
- parentChanged();
- }
- }
-
- public boolean contains(final Date d) {
- this.ensureAtLeastPartResolved();
- return d.isGreaterThanOrEqualTo(start) && d.isLessThanOrEqualTo(end);
- }
-
- public void copyObject(final BusinessValueHolder object) {
- if (!(object instanceof DatePeriod)) {
- throw new IllegalArgumentException();
- }
-
- DatePeriod dp = (DatePeriod) object;
-
- if (dp.isEmpty()) {
- clear();
- } else {
- setValue(dp);
- }
- }
-
- public boolean endsAfter(final DatePeriod arg) {
- if (getEndDate().isGreaterThan(arg.getEndDate())) {
- return true;
- } else {
- return false;
- }
- }
-
- public Date getEndDate() {
- this.ensureAtLeastPartResolved();
- return end;
- }
-
- public Date getStart() {
- this.ensureAtLeastPartResolved();
- return start;
- }
-
- public boolean isDatePeriod(final BusinessValueHolder object) {
- return object instanceof DatePeriod;
- }
-
- public boolean isEmpty() {
- return (getStart().isEmpty()) && (getEndDate().isEmpty());
- }
-
- public boolean isSameAs(final BusinessValueHolder object) {
- if (!(object instanceof DatePeriod)) {
- return false;
- } else {
- DatePeriod dp = (DatePeriod) object;
-
- return (getStart().isEqualTo(dp.getStart())) && (getEndDate().isEqualTo(dp.getEndDate()));
- }
- }
-
- public void leadDifference(final DatePeriod arg) {
- if (!this.overlaps(arg)) {
- throw new IllegalArgumentException("No overlap");
- } else {
- if (this.startsBefore(arg)) {
- getEndDate().setValue(arg.getStart());
- getEndDate().add(0, 0, -1);
- } else {
- getEndDate().setValue(getStart());
- getEndDate().add(0, 0, -1);
- getStart().setValue(arg.getStart());
- }
- }
- }
-
- public void overlap(final DatePeriod arg) {
- if (!this.overlaps(arg)) {
- throw new IllegalArgumentException("No overlap");
- } else {
- if (arg.getStart().isGreaterThan(getStart())) {
- getStart().setValue(arg.getStart());
- } else {
- getStart().setValue(getStart());
- }
-
- if (arg.getEndDate().isLessThan(getEndDate())) {
- getEndDate().setValue(arg.getEndDate());
- } else {
- getEndDate().setValue(getEndDate());
- }
- }
- }
-
- public boolean overlaps(final DatePeriod arg) {
- return (getEndDate().isGreaterThan(arg.getStart()) && start.isLessThan(arg.getEndDate()));
- }
-
- public void parseUserEntry(final String text) throws ValueParseException {
- if (text.trim().equals("")) {
- clear();
- } else {
- int dash = text.indexOf("~");
-
- if (dash == -1) {
- throw new ValueParseException("No tilde found");
- }
- Date sd = new Date();
- Date ed = new Date();
- sd.parseUserEntry(text.substring(0, dash).trim());
- ed.parseUserEntry(text.substring(dash + 1).trim());
-
- if (ed.isLessThan(sd)) {
- throw new ValueParseException("End date must be before start date");
- }
- setValue(sd, ed);
- }
- }
-
- public void reset() {
- ensureAtLeastPartResolved();
- getStart().reset();
- getEndDate().reset();
- parentChanged();
- }
-
- public void restoreFromEncodedString(final String data) {
- if (data == null || data.equals("NULL")) {
- clearInternal(false);
- } else {
- int split = data.indexOf('~');
- getStart().restoreFromEncodedString(data.substring(0, split));
- getEndDate().restoreFromEncodedString(data.substring(split + 1));
- }
- }
-
- public String asEncodedString() {
- if (getStart().isEmpty() || getEndDate().isEmpty()) {
- return "NULL";
- } else {
- return getStart().asEncodedString() + "~" + getEndDate().asEncodedString();
- }
- }
-
- public void setValue(final Date start, final Date end) {
- getStart().setValue(start);
- getEndDate().setValue(end);
- parentChanged();
- }
-
- public void setValue(final DatePeriod dp) {
- setValue(dp.getStart(), dp.getEndDate());
- }
-
- public boolean startsBefore(final DatePeriod arg) {
- if (getStart().isLessThan(arg.getStart())) {
- return true;
- } else {
- return false;
- }
- }
-
- public void tailDifference(final DatePeriod arg) {
- if (!this.overlaps(arg)) {
- throw new IllegalArgumentException("No overlap");
- } else {
- if (this.endsAfter(arg)) {
- getStart().setValue(arg.getEndDate());
- getStart().add(0, 0, 1);
- } else {
- getStart().setValue(getEndDate());
- getStart().add(0, 0, 1);
- getEndDate().setValue(arg.getEndDate());
- }
- }
- }
-
- public Title title() {
- Title t = new Title(getStart() == null ? "" : getStart().title().toString());
- t.append("~");
- t.append(getEndDate() == null ? "" : getEndDate().title().toString());
-
- return t;
- }
-
- /*
- * To be added:
- *
- * method to test that a magnitude falls within the range method to test if two ranges are contiguous
- * method to return the enclosing range for two ranges method to test if one range falls entirely within
- * another
- */
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/DatePeriodTest.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/DatePeriodTest.java b/framework/applib/src/main/src-archived/old-valueholders/DatePeriodTest.java
deleted file mode 100644
index a576c32..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/DatePeriodTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.value.ValueParseException;
-
-import java.util.Locale;
-
-
-public class DatePeriodTest extends ValueTestCase {
- static {
- Locale.setDefault(Locale.UK);
- }
-
- private DatePeriod mayJul, junAug, junJul, dp1, dp2;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- mayJul = new DatePeriod();
- mayJul.getStart().setValue(2003, 5, 1);
- mayJul.getEndDate().setValue(2003, 7, 31);
-
- junAug = new DatePeriod();
- junAug.getStart().setValue(2003, 6, 1);
- junAug.getEndDate().setValue(2003, 8, 31);
-
- junJul = new DatePeriod();
- junJul.getStart().setValue(2003, 6, 1);
- junJul.getEndDate().setValue(2003, 7, 31);
-
- dp1 = new DatePeriod();
- dp2 = new DatePeriod();
- }
-
- public void testLocale() {
- assertEquals(Locale.UK, Locale.getDefault());
-
- }
-
- protected void tearDown() throws Exception {
- mayJul = null;
- junAug = null;
- junJul = null;
- }
-
- public void testClear() {
- mayJul.clear();
- assertTrue(mayJul.title().toString().equals("~"));
- assertTrue(mayJul.isEmpty());
- }
-
- public void testOverlaps() throws Exception {
-
- assertTrue(mayJul.startsBefore(junAug));
- assertFalse(junAug.startsBefore(mayJul));
- assertTrue(junAug.endsAfter(mayJul));
- assertFalse(mayJul.endsAfter(junAug));
-
- assertTrue(mayJul.overlaps(junAug));
-
- DatePeriod overlap = new DatePeriod(mayJul);
- overlap.overlap(junAug);
- assertTrue(junJul.isSameAs(overlap));
-
- overlap = new DatePeriod(junAug);
- overlap.overlap(mayJul);
- assertTrue(junJul.isSameAs(overlap));
-
- DatePeriod lead = new DatePeriod(junAug);
- lead.leadDifference(mayJul);
- // assertEquals("01-May-2003 ~ 31-May-2003", lead.title().toString());
-
- DatePeriod tail = new DatePeriod(junAug);
- tail.tailDifference(mayJul);
- assertEquals("01-Aug-2003 ~ 31-Aug-2003", tail.title().toString());
- }
-
- public void testParse() throws Exception {
- dp1.parseUserEntry("14-Apr-2003 ~ 16-Nov-2004");
- assertEquals("14-Apr-2003 ~ 16-Nov-2004", dp1.title().toString());
- dp1.parseUserEntry("15-Jan-2002 ~ 6-May-2005");
- assertEquals("15-Jan-2002 ~ 06-May-2005", dp1.title().toString());
- dp1.parseUserEntry("5-jan-2002~06-may-2005");
- assertEquals("05-Jan-2002 ~ 06-May-2005", dp1.title().toString());
- try {
- dp1.parseUserEntry("hgjuiy");
- fail();
- } catch (ValueParseException e) {
- assertTrue(e.getMessage().equals("No tilde found"));
- }
- try {
- dp1.parseUserEntry("05-Jan-2002 - 06-May-2005");
- fail();
- } catch (ValueParseException e) {
- assertTrue(e.getMessage().equals("No tilde found"));
- }
- try {
- dp1.parseUserEntry("rtyu~ghjk");
- fail();
- } catch (ValueParseException e) {
- assertTrue(e.getMessage().equals("Invalid date rtyu"));
- }
- try {
- dp1.parseUserEntry("14-Apr-2003 ~ 16-Nov-2002");
- fail();
- } catch (ValueParseException expected) {}
-
- dp1.parseUserEntry("14-Apr-2003~");
- assertTrue(dp1.title().toString().equals("14-Apr-2003 ~"));
- dp1.parseUserEntry("~16-Nov-2004");
- assertTrue(dp1.title().toString().equals("~ 16-Nov-2004"));
-
- }
-
- public void testSaveAndRestore() throws Exception {
- dp1.parseUserEntry("04-May-2003 ~ 16-May-2004");
- String s = dp1.asEncodedString();
- assertEquals("20030504~20040516", s);
- dp2.restoreFromEncodedString(s);
- assertEquals("04-May-2003 ~ 16-May-2004", dp2.title().toString());
- assertTrue(dp1.isSameAs(dp2));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/DateTest.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/DateTest.java b/framework/applib/src/main/src-archived/old-valueholders/DateTest.java
deleted file mode 100644
index be1e43a..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/DateTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.system.TestClock;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-
-
-public class DateTest extends ValueTestCase {
-
- private Date actual;
-
- protected void setUp() throws Exception {
- Logger.getRootLogger().setLevel(Level.OFF);
-
- Date.setClock(new TestClock());
- actual = new Date(2000, 2, 1);
- }
-
- public void testGetDay() {
- assertEquals(1, actual.getDay());
- }
-
- public void testGetMonth() {
- assertEquals(2, actual.getMonth());
- }
-
- public void testGetYear() {
- assertEquals(2000, actual.getYear());
- }
-
- public void testNew() {
- Date expected = new Date(2003, 8, 17);
- Date actual = new Date();
- assertEquals(expected, actual);
- }
-
- public void testReset() {
- Date expected = new Date(2003, 8, 17);
- actual.reset();
- assertEquals(expected, actual);
- }
-
- public void testSaveRestore() throws Exception {
- Date date1 = new Date();
- date1.parseUserEntry("2003-1-4");
- assertFalse(date1.isEmpty());
-
- Date date2 = new Date();
- date2.restoreFromEncodedString(date1.asEncodedString());
- assertEquals(date1.dateValue(), date2.dateValue());
- assertFalse(date2.isEmpty());
- }
-
- public void testSaveRestorOfNull() throws Exception {
- Date date1 = new Date();
- date1.clear();
- assertTrue("Date isEmpty", date1.isEmpty());
-
- Date date2 = new Date();
- date2.restoreFromEncodedString(date1.asEncodedString());
- assertEquals(date1.dateValue(), date2.dateValue());
- assertTrue(date2.isEmpty());
- }
-
- public void testToday() {
- Date expected = new Date(2003, 8, 17);
- actual.today();
- assertEquals(expected, actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/DateTime.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/DateTime.java b/framework/applib/src/main/src-archived/old-valueholders/DateTime.java
deleted file mode 100644
index d251aef..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/DateTime.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-import org.apache.isis.application.ApplicationException;
-import org.apache.isis.application.BusinessObject;
-import org.apache.isis.application.Clock;
-import org.apache.isis.application.Title;
-import org.apache.isis.application.value.ValueParseException;
-
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-
-/**
- * Value object representing a date and time value.
- * <p>
- * NOTE: this class currently does not support about listeners
- * </p>
- */
-public class DateTime extends Magnitude {
- private static final long serialVersionUID = 1L;
- private static final DateFormat SHORT_FORMAT = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
- private static final DateFormat MEDIUM_FORMAT = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT);
- private static final DateFormat LONG_FORMAT = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
- private static final DateFormat ISO_LONG = new SimpleDateFormat("yyyy-MM-dd HH:mm");
- private static final DateFormat ISO_SHORT = new SimpleDateFormat("yyyyMMdd'T'HHmm");
-
- private transient DateFormat format = MEDIUM_FORMAT;
- private boolean isNull = true;
- private java.util.Date date;
- private static Clock clock;
-
- public static void setClock(final Clock clock) {
- DateTime.clock = clock;
-
- ISO_LONG.setLenient(false);
- ISO_SHORT.setLenient(false);
- LONG_FORMAT.setLenient(false);
- MEDIUM_FORMAT.setLenient(false);
- SHORT_FORMAT.setLenient(false);
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the current time.
- */
- public DateTime() {
- this((BusinessObject) null);
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the specified hours and minutes.
- *
- * @deprecated replaced by TimeStamp(int year, int month, int day, int hour, int minute, int second)
- */
- public DateTime(final int year, final int month, final int day, final int hour, final int minute) {
- this(null, year, month, day, hour, minute, 0);
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the specified hours and minutes.
- */
- public DateTime(final int year, final int month, final int day, final int hour, final int minute, final int second) {
- this(null, year, month, day, hour, minute, second);
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the specified time.
- */
- public DateTime(final DateTime timeStamp) {
- this(null, timeStamp);
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the current time.
- */
- public DateTime(final BusinessObject parent) {
- super(parent);
- if (clock == null) {
- throw new ApplicationException("Clock not set up");
- }
- setValue(new java.util.Date(clock.getTime()));
- isNull = false;
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the specified hours and minutes.
- */
- public DateTime(final BusinessObject parent, final int year, final int month, final int day, final int hour, final int minute, final int second) {
- super(parent);
- setValue(year, month, day, hour, minute, second);
- isNull = false;
- }
-
- /**
- * Create a Time object for storing a timeStamp set to the specified time.
- */
- public DateTime(final BusinessObject parent, final DateTime timeStamp) {
- super(parent);
- date = timeStamp.date;
- isNull = timeStamp.isNull;
- }
-
- /**
- * Add the specified days, years and months to this date value.
- */
- public void add(final int hours, final int minutes, final int seconds) {
- Calendar cal = Calendar.getInstance();
-
- cal.setTime(date);
- cal.add(Calendar.SECOND, seconds);
- cal.add(Calendar.MINUTE, minutes);
- cal.add(Calendar.HOUR_OF_DAY, hours);
- set(cal);
- }
-
- private void checkTime(final int year, final int month, final int day, final int hour, final int minute, final int second) {
- if ((month < 1) || (month > 12)) {
- throw new IllegalArgumentException("Month must be in the range 1 - 12 inclusive " + month);
- }
-
- Calendar cal = Calendar.getInstance();
-
- cal.set(year, month - 1, 0);
-
- int lastDayOfMonth = cal.getMaximum(Calendar.DAY_OF_MONTH);
-
- if ((day < 1) || (day > lastDayOfMonth)) {
- throw new IllegalArgumentException("Day must be in the range 1 - " + lastDayOfMonth + " inclusive " + day);
- }
-
- if ((hour < 0) || (hour > 23)) {
- throw new IllegalArgumentException("Hour must be in the range 0 - 23 inclusive " + hour);
- }
-
- if ((minute < 0) || (minute > 59)) {
- throw new IllegalArgumentException("Minute must be in the range 0 - 59 inclusive " + minute);
- }
-
- if ((second < 0) || (second > 59)) {
- throw new IllegalArgumentException("Second must be in the range 0 - 59 inclusive " + second);
- }
- }
-
- public void clear() {
- setValuesInternal(date, true, true);
- }
-
- public void copyObject(final BusinessValueHolder object) {
- if (object == null) {
- this.clear();
- } else if (!(object instanceof DateTime)) {
- throw new IllegalArgumentException("Can only copy the value of a TimeStamp object");
- } else {
- setValue((DateTime) object);
- }
- }
-
- /**
- * Returns a Calendar object with the irrelevant field (determined by this objects type) set to zero.
- */
- private Calendar createCalendar() {
- Calendar cal = Calendar.getInstance();
-
- // clear all aspects of the time that are not used
- cal.set(Calendar.MILLISECOND, 0);
-
- return cal;
- }
-
- public java.util.Date dateValue() {
- this.ensureAtLeastPartResolved();
- return isNull ? null : date;
- }
-
- public boolean equals(final Object obj) {
- this.ensureAtLeastPartResolved();
- if (obj instanceof DateTime) {
- DateTime d = (DateTime) obj;
- return d.date.equals(date);
- }
- return super.equals(obj);
- }
-
- /**
- * Return true if the time stamp is blank
- */
- public boolean isEmpty() {
- this.ensureAtLeastPartResolved();
- return isNull;
- }
-
- /**
- * returns true if the time stamp of this object has the same value as the specified time
- */
- public boolean isEqualTo(final Magnitude timeStamp) {
- this.ensureAtLeastPartResolved();
- if (timeStamp instanceof DateTime) {
- if (isNull) {
- return timeStamp.isEmpty();
- }
-
- return this.date.equals(((DateTime) timeStamp).date);
- } else {
- throw new IllegalArgumentException("Parameter must be of type Time");
- }
- }
-
- /**
- * returns true if the timeStamp of this object is earlier than the specified timeStamp
- */
- public boolean isLessThan(final Magnitude timeStamp) {
- this.ensureAtLeastPartResolved();
- if (timeStamp instanceof DateTime) {
- return !isNull && !timeStamp.isEmpty() && date.before(((DateTime) timeStamp).date);
- } else {
- throw new IllegalArgumentException("Parameter must be of type Time");
- }
- }
-
- public int getDay() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.DAY_OF_MONTH);
- }
-
- public int getMonth() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.MONTH) + 1;
- }
-
- public int getYear() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.YEAR);
- }
-
- public int getHour() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.HOUR);
- }
-
- public int getMinute() {
- this.ensureAtLeastPartResolved();
- Calendar c = Calendar.getInstance();
- c.setTime(date);
- return c.get(Calendar.MINUTE);
- }
-
- public long longValue() {
- this.ensureAtLeastPartResolved();
- return date.getTime();
- }
-
- public void parseUserEntry(final String entry) throws ValueParseException {
- if (entry.trim().equals("")) {
- clear();
- } else {
- String text = entry.trim();
-
- String str = text.toLowerCase();
- Calendar cal = createCalendar();
-
- if (str.equals("today") || str.equals("now")) {} else if (str.startsWith("+")) {
- int hours;
-
- hours = Integer.valueOf(str.substring(1)).intValue();
- cal.setTime(date);
- cal.add(Calendar.HOUR, hours);
- } else if (str.startsWith("-")) {
- int hours;
-
- hours = Integer.valueOf(str.substring(1)).intValue();
- cal.setTime(date);
- cal.add(Calendar.HOUR, -hours);
- } else {
- DateFormat[] formats = new DateFormat[] { LONG_FORMAT, MEDIUM_FORMAT, SHORT_FORMAT, ISO_LONG, ISO_SHORT };
-
- for (int i = 0; i < formats.length; i++) {
- try {
- cal.setTime(formats[i].parse(text));
-
- break;
- } catch (ParseException e) {
- if ((i + 1) == formats.length) {
- throw new ValueParseException("Invalid timeStamp " + text, e);
- }
- }
- }
- }
-
- set(cal);
- }
- }
-
- /**
- * Reset this time so it contains the current time.
- *
- */
- public void reset() {
- setValuesInternal(new Date(clock.getTime()), false, true);
- }
-
- private void set(final Calendar cal) {
- setValuesInternal(cal.getTime(), false, true);
- }
-
- private void setValuesInternal(final Date date, final boolean isNull, final boolean notify) {
- if (notify) {
- ensureAtLeastPartResolved();
- }
- this.date = date;
- this.isNull = isNull;
- if (notify) {
- parentChanged();
- }
- }
-
- private void setValuesInternal(
- final int year, final int month, final int day, final int hour, final int minute, final int second, final boolean notify) {
- checkTime(year, month, day, hour, minute, second);
-
- Calendar cal = createCalendar();
-
- cal.set(Calendar.DAY_OF_MONTH, day);
- cal.set(Calendar.MONTH, month - 1);
- cal.set(Calendar.YEAR, year);
- cal.set(Calendar.HOUR_OF_DAY, hour);
- cal.set(Calendar.MINUTE, minute);
- cal.set(Calendar.SECOND, second);
- cal.set(Calendar.MILLISECOND, 0);
- setValuesInternal(cal.getTime(), false, notify);
- }
-
- public void setValue(final java.util.Date date) {
- if (date == null) {
- setValuesInternal(date, true, true);
- } else {
- Calendar cal = Calendar.getInstance();
- cal.setTime(date);
- cal.set(Calendar.MILLISECOND, 0);
- set(cal);
- }
- }
-
- public void setValue(final long time) {
- setValuesInternal(new Date(time), false, true);
- }
-
- public void setValue(final DateTime timeStamp) {
- if (timeStamp == null) {
- setValuesInternal(date, true, true);
- } else {
- setValuesInternal(new Date(timeStamp.date.getTime()), false, true);
- }
- }
-
- /*
- * Sets this object's timeStamp to be the same as the specified hour, minute and second.
- */
- public void setValue(final int year, final int month, final int day, final int hour, final int minute, final int second) {
- setValuesInternal(year, month, day, hour, minute, second, false);
- }
-
- public Title title() {
- this.ensureAtLeastPartResolved();
- return new Title(isNull ? "" : format.format(date));
- }
-
- public Calendar calendarValue() {
- this.ensureAtLeastPartResolved();
- if (isNull) {
- return null;
- }
-
- Calendar c = Calendar.getInstance();
- c.setTime(date);
-
- return c;
- }
-
- public void restoreFromEncodedString(final String data) {
- if (data == null || data.equals("NULL")) {
- this.setValuesInternal(date, true, false);
- } else {
- int year = Integer.valueOf(data.substring(0, 4)).intValue();
- int month = Integer.valueOf(data.substring(4, 6)).intValue();
- int day = Integer.valueOf(data.substring(6, 8)).intValue();
- int hour = Integer.valueOf(data.substring(8, 10)).intValue();
- int minute = Integer.valueOf(data.substring(10, 12)).intValue();
- int second = Integer.valueOf(data.substring(12, 14)).intValue();
- setValuesInternal(year, month, day, hour, minute, second, false);
- }
- }
-
- public String asEncodedString() {
- if (isEmpty()) {
- return "NULL";
- } else {
- Calendar cal = calendarValue();
- StringBuffer data = new StringBuffer(8);
- String year = String.valueOf(cal.get(Calendar.YEAR));
- data.append("0000".substring(0, 4 - year.length()));
- data.append(year);
-
- int month = cal.get(Calendar.MONTH) + 1;
- data.append((month <= 9) ? "0" : "");
- data.append(month);
-
- int day = cal.get(Calendar.DAY_OF_MONTH);
- data.append((day <= 9) ? "0" : "");
- data.append(day);
-
- int hour = cal.get(Calendar.HOUR_OF_DAY);
- data.append((hour <= 9) ? "0" : "");
- data.append(hour);
-
- int minute = cal.get(Calendar.MINUTE);
- data.append((minute <= 9) ? "0" : "");
- data.append(minute);
-
- int second = cal.get(Calendar.SECOND);
- data.append((second <= 9) ? "0" : "");
- data.append(second);
-
- return data.toString();
- }
- }
-
- public String toString() {
- // title() ensures this is resolved
- return title() + " " + longValue() + " [DateTime]";
- }
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/dbb64345/framework/applib/src/main/src-archived/old-valueholders/DateTimeTest.java
----------------------------------------------------------------------
diff --git a/framework/applib/src/main/src-archived/old-valueholders/DateTimeTest.java b/framework/applib/src/main/src-archived/old-valueholders/DateTimeTest.java
deleted file mode 100644
index 97b2fca..0000000
--- a/framework/applib/src/main/src-archived/old-valueholders/DateTimeTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-
-package org.apache.isis.application.valueholder;
-
-public class DateTimeTest extends ValueTestCase {
- private DateTime actual;
-
- protected void setUp() throws Exception {
- super.setUp();
- actual = new DateTime(2000, 2, 1, 10, 59, 30);
- }
-
- public void testGetDay() {
- assertEquals(1, actual.getDay());
- }
-
- public void testGetMonth() {
- assertEquals(2, actual.getMonth());
- }
-
- public void testGetYear() {
- assertEquals(2000, actual.getYear());
- }
-
- public void testGetMinute() {
- assertEquals(59, actual.getMinute());
- }
-
- public void testGetHour() {
- assertEquals(10, actual.getHour());
- }
-
- public void testSaveRestore() throws Exception {
- DateTime timeStamp1 = new DateTime();
- timeStamp1.parseUserEntry("2003-1-4 10:45");
- assertFalse(timeStamp1.isEmpty());
-
- DateTime timeStamp2 = new DateTime();
- timeStamp2.restoreFromEncodedString(timeStamp1.asEncodedString());
- assertEquals(timeStamp1.longValue(), timeStamp2.longValue());
- assertFalse(timeStamp2.isEmpty());
- }
-
- public void testSaveRestorOfNull() throws Exception {
- DateTime timeStamp1 = new DateTime();
- timeStamp1.clear();
- assertTrue("DateTime isEmpty", timeStamp1.isEmpty());
-
- DateTime timeStamp2 = new DateTime();
- timeStamp2.restoreFromEncodedString(timeStamp1.asEncodedString());
- // assertEquals(timeStamp1.longValue(), timeStamp2.longValue());
- assertTrue(timeStamp2.isEmpty());
- }
-
- public void testNew() {
- DateTime expected = new DateTime(2003, 8, 17, 21, 30, 25);
- DateTime actual = new DateTime();
-
-// FIX assertEquals(expected, actual);
- }
-
- public void testNow() {
- DateTime expected = new DateTime(2003, 8, 17, 21, 30, 25);
- DateTime actual = new DateTime();
- actual.reset();
- // FIX assertEquals(expected, actual);
- }
-}