diff options
Diffstat (limited to 'branches/sca-equinox/modules/core-spi/src')
14 files changed, 0 insertions, 767 deletions
diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java deleted file mode 100644 index 992c1188f7..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/Event.java +++ /dev/null @@ -1,33 +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.tuscany.sca.event; - -/** - * The base interface for events that are propagated in the runtime - * - * @version $Rev$ $Date$ - */ -public interface Event { - - /** - * Returns the source of the event - */ - Object getSource(); - -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java deleted file mode 100644 index d17aebd7e8..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventFilter.java +++ /dev/null @@ -1,35 +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.tuscany.sca.event; - -/** - * Evaluates whether a {@link RuntimeEventListener} is applicable to a given runtime event - * - * @version $Rev$ $Date$ - */ -public interface EventFilter { - - /** - * Performs the actual evaluation on an event - * @param event Returns true if the event matches implemented criteria - * @return Match result - */ - boolean match(Event event); - -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java deleted file mode 100644 index f209eb8936..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/EventPublisher.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.event; - -/** - * Publishes events in the runtime by accepting {@link Event} objects and - * forwarding them to all registered {@link RuntimeEventListener} objects. - * - * @version $Rev$ $Date$ - */ -public interface EventPublisher { - - /** - * Publish an event to all registered listeners - * @param object The event to publish - */ - void publish(Event object); - - /** - * Registers a listener to receive notifications for the context - * @param listener The listener to add - */ - void addListener(RuntimeEventListener listener); - - /** - * Registers a listener to receive notifications for the context - * @param filter The filter that will be applied before the lister is called - * @param listener The lister to add - */ - void addListener(EventFilter filter, RuntimeEventListener listener); - - - /** - * Removes a previously registered listener - * @param listener The listener to remove - */ - void removeListener(RuntimeEventListener listener); - -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java deleted file mode 100644 index b34dceee62..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/RuntimeEventListener.java +++ /dev/null @@ -1,35 +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.tuscany.sca.event; - -import java.util.EventListener; - -/** - * Listeners observe events fired in the SCA runtime. - * - * @version $Rev$ $Date$ - */ -public interface RuntimeEventListener extends EventListener { - - /** - * Accepts and event and acts on it - * @param event The event to act on - */ - void onEvent(Event event); -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java deleted file mode 100644 index f888908340..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/event/TrueFilter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.event; - -/** - * An event filter that always returns a true condition - * - * @version $Rev$ $Date$ - */ -public class TrueFilter implements EventFilter { - - /** - * Performs the actual evaluation on an event. Always returns true - * in this case - * @param event The incoming event which is ignored - * @return true - */ - public boolean match(Event event) { - return true; - } -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java deleted file mode 100644 index 7d5cd6c54b..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/DuplicateRecordException.java +++ /dev/null @@ -1,56 +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.tuscany.sca.store; - -/** - * thrown when a record already exists during an insert operation - * - * @version $Rev$ $Date$ - */ -public class DuplicateRecordException extends StoreWriteException { - private static final long serialVersionUID = 3116253222569378447L; - - /** - * {@inheritDoc} - */ - public DuplicateRecordException() { - super(); - } - - /** - * {@inheritDoc} - */ - public DuplicateRecordException(String message, Throwable cause) { - super(message, cause); - } - - /** - * {@inheritDoc} - */ - public DuplicateRecordException(String message) { - super(message); - } - - /** - * {@inheritDoc} - */ - public DuplicateRecordException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java deleted file mode 100644 index 9d965a3369..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/RecoveryListener.java +++ /dev/null @@ -1,46 +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.tuscany.sca.store; - -import java.util.UUID; - -/** - * Implementations receive callback events during a store recovery operation - * - * @version $Rev$ $Date$ - */ -public interface RecoveryListener { - - /** - * Signals the start of a recovery - */ - void onBegin(); - - /** - * Received when a record is recovered - * - * @param id - */ - void onRecord(UUID id); - - /** - * Signals the end of recovery - */ - void onEnd(); -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java deleted file mode 100644 index b15cde066a..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/Store.java +++ /dev/null @@ -1,96 +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.tuscany.sca.store; - -import org.apache.tuscany.sca.event.EventPublisher; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * Implementations provide a persistent store for runtime data such as conversational state. A persistent store could be - * implemented in a durable fashion using JDBC or a journaling system, or using a non-durable mechanism such as an - * in-memory map. - * - * @version $Rev$ $Date$ - */ -public interface Store extends EventPublisher { - - /* Used to indicate an the default expiration offset for records for the store */ - long DEFAULT_EXPIRATION_OFFSET = -1; - - /* Used to indicate an entry should not expire */ - long NEVER = -2; - - /** - * Adds the given record to the store. Implementations may choose different strategies for writing data such as - * write-through or write-behind. - * - * @param owner the instance owner - * @param id the unique id of the record - * @param object the object representing the data to write - * @param expiration the time in milliseconds when the entry expires - * @throws StoreWriteException if an error occurs during the write operation - */ - void insertRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException; - - /** - * Updates a given record in the store, overwriting previous information. - * - * @param owner the instance owner - * @param id the unique id of the record - * @param object the object representing the data to write - * @param expiration the time in milliseconds when the entry expires - * @throws StoreWriteException - */ - void updateRecord(RuntimeComponent owner, String id, Object object, long expiration) throws StoreWriteException; - - /** - * Returns the deserialized object in the store corresponding to the given id - * - * @param owner the instance owner - * @param id the unique id of the record - * @return the deserialized object or null if one is not found - * @throws StoreReadException - */ - Object readRecord(RuntimeComponent owner, String id) throws StoreReadException; - - /** - * Removes a record from the store - * - * @param owner the instance owner - * @param id the unique id of the record - * @throws StoreWriteException - */ - void removeRecord(RuntimeComponent owner, String id) throws StoreWriteException; - - /** - * Removes all records from the store - * - * @throws StoreWriteException - */ - void removeRecords() throws StoreWriteException; - - /** - * Initiates a recovery operation, for example during restart after a crash - * - * @param listener the listener to receive recovery callback events - * @throws StoreReadException - */ - void recover(RecoveryListener listener) throws StoreReadException; - -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java deleted file mode 100644 index 24eaddd3e0..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreException.java +++ /dev/null @@ -1,57 +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.tuscany.sca.store; - - -/** - * Represents a generic exception thrown by a <code>Store</code> - * - * @version $Rev$ $Date$ - */ -public class StoreException extends Exception { - private static final long serialVersionUID = -319152147419962709L; - - /** - * {@inheritDoc} - */ - public StoreException() { - super(); - } - - /** - * {@inheritDoc} - */ - public StoreException(String message, Throwable cause) { - super(message, cause); - } - - /** - * {@inheritDoc} - */ - public StoreException(String message) { - super(message); - } - - /** - * {@inheritDoc} - */ - public StoreException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java deleted file mode 100644 index 5c1a3ca79d..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreExpirationEvent.java +++ /dev/null @@ -1,71 +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.tuscany.sca.store; - -import org.apache.tuscany.sca.event.Event; -import org.apache.tuscany.sca.runtime.RuntimeComponent; - -/** - * Fired when a store implementation expires a resource - * - * @version $Rev$ $Date$ - */ -public class StoreExpirationEvent implements Event { - private Object source; - private RuntimeComponent owner; - private Object instance; - - /** - * Constructor. - * - * @param source the source of the event - * @param owner the owner of the expiring object - * @param instance the expiring object - */ - public StoreExpirationEvent(Object source, RuntimeComponent owner, Object instance) { - assert source != null; - assert owner != null; - assert instance != null; - this.source = source; - this.owner = owner; - this.instance = instance; - } - - public Object getSource() { - return source; - } - - /** - * Returns the owner of the expiring object. - * - * @return the owner of the expiring object. - */ - public RuntimeComponent getOwner() { - return owner; - } - - /** - * Returns the expiring object. - * - * @return the expiring object. - */ - public Object getInstance() { - return instance; - } -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java deleted file mode 100644 index 4bc7facf39..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreMonitor.java +++ /dev/null @@ -1,71 +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.tuscany.sca.store; - - -/** - * A generic monitor interface for services to log events - * - * @version $Rev$ $Date$ - */ -public interface StoreMonitor { - - /** - * Signals the service has started - * - * @param msg - */ - void start(String msg); - - /** - * Signals the service has been shutdown - * - * @param msg - */ - void stop(String msg); - - /** - * Fired when recovery is started - */ - - void beginRecover(); - - /** - * Fired when recovery is completed - */ - - void endRecover(); - - /** - * Fired when a record is processed during recovery - * - * @param recordId the id of the record being recovered - */ - - void recover(Object recordId); - - /** - * Signals an error event - * - * @param e the error - */ - - void error(Throwable e); - -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java deleted file mode 100644 index c2346bddca..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreReadException.java +++ /dev/null @@ -1,56 +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.tuscany.sca.store; - -/** - * Thrown when an error occurs reading from persistent storage - * - * @version $Rev$ $Date$ - */ -public class StoreReadException extends StoreException { - private static final long serialVersionUID = -8624542082121467271L; - - /** - * {@inheritDoc} - */ - public StoreReadException() { - super(); - } - - /** - * {@inheritDoc} - */ - public StoreReadException(String message, Throwable cause) { - super(message, cause); - } - - /** - * {@inheritDoc} - */ - public StoreReadException(String message) { - super(message); - } - - /** - * {@inheritDoc} - */ - public StoreReadException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java b/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java deleted file mode 100644 index b37519b31c..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/main/java/org/apache/tuscany/sca/store/StoreWriteException.java +++ /dev/null @@ -1,56 +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.tuscany.sca.store; - -/** - * Thrown when an error occurs writing to persistent storage - * - * @version $Rev$ $Date$ - */ -public class StoreWriteException extends StoreException { - private static final long serialVersionUID = 5539070473942048555L; - - /** - * {@inheritDoc} - */ - public StoreWriteException() { - super(); - } - - /** - * {@inheritDoc} - */ - public StoreWriteException(String message, Throwable cause) { - super(message, cause); - } - - /** - * {@inheritDoc} - */ - public StoreWriteException(String message) { - super(message); - } - - /** - * {@inheritDoc} - */ - public StoreWriteException(Throwable cause) { - super(cause); - } -} diff --git a/branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java b/branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java deleted file mode 100644 index 2425133273..0000000000 --- a/branches/sca-equinox/modules/core-spi/src/test/java/org/apache/tuscany/sca/event/TrueFilterTestCase.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.event; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Test case for TrueFilter - * - * @version $Rev$ $Date$ - */ -public class TrueFilterTestCase { - - /** - * Test TrueFilter matching an event - */ - @Test - public void testTrueFilterMatch() { - EventFilter filter = new TrueFilter(); - - Assert.assertTrue(filter.match(new DummyEvent())); - } - - /** - * Test TrueFilter matching null - */ - @Test - public void testTrueFilterMatchNull() { - EventFilter filter = new TrueFilter(); - - Assert.assertTrue(filter.match(null)); - } - - /** - * Dummy Event implementation for testing - */ - private class DummyEvent implements Event { - - /** - * {@inheritDoc} - */ - public Object getSource() { - throw new UnsupportedOperationException(); - } - } -} |