You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jm...@apache.org on 2006/11/04 23:24:47 UTC
svn commit: r471279 - in
/incubator/tuscany/java/sca/services/persistence/datasource/src:
main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java
test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java
Author: jmarino
Date: Sat Nov 4 14:24:47 2006
New Revision: 471279
URL: http://svn.apache.org/viewvc?view=rev&rev=471279
Log:
support provider close callback
Added:
incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java (with props)
Modified:
incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java
Modified: incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java?view=diff&rev=471279&r1=471278&r2=471279
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java (original)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/main/java/org/apache/tuscany/persistence/datasource/DataSourceComponent.java Sat Nov 4 14:24:47 2006
@@ -63,6 +63,16 @@
return scopeContainer.getInstance(this);
}
+ public void destroy(Object instance) throws TargetException {
+ if (instance instanceof DataSourceProvider) {
+ try {
+ ((DataSourceProvider) instance).close();
+ } catch (ProviderException e) {
+ throw new TargetException(e);
+ }
+ }
+ }
+
protected void onReferenceWire(OutboundWire wire) {
throw new UnsupportedOperationException("Wires not supported for DataSource components");
}
Added: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java?view=auto&rev=471279
==============================================================================
--- incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java (added)
+++ incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java Sat Nov 4 14:24:47 2006
@@ -0,0 +1,39 @@
+/*
+ * 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.persistence.datasource;
+
+import junit.framework.TestCase;
+import org.easymock.EasyMock;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DataSourceComponentTestCase extends TestCase {
+
+ public void testDestroy() throws Exception {
+ DataSourceProvider provider = EasyMock.createMock(DataSourceProvider.class);
+ provider.close();
+ EasyMock.replay(provider);
+ DataSourceComponent component = new DataSourceComponent(null, null, null, null, 0);
+ component.destroy(provider);
+ EasyMock.verify(provider);
+ }
+
+
+}
Propchange: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/services/persistence/datasource/src/test/java/org/apache/tuscany/persistence/datasource/DataSourceComponentTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org