[teiid-commits] teiid SVN: r2847 - in branches/7.1.x/client/src: test/java/org/teiid/adminapi/impl and 1 other directory.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Tue Jan 18 13:12:05 EST 2011
Author: shawkins
Date: 2011-01-18 13:12:05 -0500 (Tue, 18 Jan 2011)
New Revision: 2847
Added:
branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
Modified:
branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
Log:
TEIID-1420 fixing the next issue with transaction metadata
Modified: branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java
===================================================================
--- branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2011-01-17 21:54:13 UTC (rev 2846)
+++ branches/7.1.x/client/src/main/java/org/teiid/adminapi/impl/TransactionMetadataMapper.java 2011-01-18 18:12:05 UTC (rev 2847)
@@ -36,7 +36,7 @@
import org.jboss.metatype.spi.values.MetaMapper;
public class TransactionMetadataMapper extends MetaMapper<TransactionMetadata> {
- private static final String XID = "xid"; //$NON-NLS-1$
+ private static final String ID = "id"; //$NON-NLS-1$
private static final String SCOPE = "scope"; //$NON-NLS-1$
private static final String CREATED_TIME = "createdTime"; //$NON-NLS-1$
private static final String ASSOCIATED_SESSION = "associatedSession"; //$NON-NLS-1$
@@ -48,7 +48,7 @@
metaType.addItem(ASSOCIATED_SESSION, ASSOCIATED_SESSION, SimpleMetaType.STRING);
metaType.addItem(CREATED_TIME, CREATED_TIME, SimpleMetaType.LONG_PRIMITIVE);
metaType.addItem(SCOPE, SCOPE, SimpleMetaType.STRING);
- metaType.addItem(XID, XID, SimpleMetaType.STRING);
+ metaType.addItem(ID, ID, SimpleMetaType.STRING);
metaType.freeze();
}
@@ -73,7 +73,7 @@
transaction.set(ASSOCIATED_SESSION, SimpleValueSupport.wrap(object.getAssociatedSession()));
transaction.set(CREATED_TIME, SimpleValueSupport.wrap(object.getCreatedTime()));
transaction.set(SCOPE, SimpleValueSupport.wrap(object.getScope()));
- transaction.set("id", SimpleValueSupport.wrap(object.getId())); //$NON-NLS-1$
+ transaction.set(ID, SimpleValueSupport.wrap(object.getId()));
return transaction;
}
@@ -92,7 +92,7 @@
transaction.setAssociatedSession((String) metaValueFactory.unwrap(compositeValue.get(ASSOCIATED_SESSION)));
transaction.setCreatedTime((Long) metaValueFactory.unwrap(compositeValue.get(CREATED_TIME)));
transaction.setScope((String) metaValueFactory.unwrap(compositeValue.get(SCOPE)));
- transaction.setId((String) metaValueFactory.unwrap(compositeValue.get("id"))); //$NON-NLS-1$
+ transaction.setId((String) metaValueFactory.unwrap(compositeValue.get(ID)));
return transaction;
}
throw new IllegalStateException("Unable to unwrap TransactionMetadata " + metaValue); //$NON-NLS-1$
Added: branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
===================================================================
--- branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java (rev 0)
+++ branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java 2011-01-18 18:12:05 UTC (rev 2847)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.adminapi.impl;
+
+import static org.junit.Assert.*;
+
+import org.jboss.metatype.api.values.MetaValue;
+import org.junit.Test;
+
+ at SuppressWarnings("nls")
+public class TestTransactionMetadata {
+
+ @Test public void testMapping() {
+ TransactionMetadata tm = new TransactionMetadata();
+ tm.setAssociatedSession("x");
+
+ TransactionMetadataMapper tmm = new TransactionMetadataMapper();
+ MetaValue mv = tmm.createMetaValue(tmm.getMetaType(), tm);
+
+ TransactionMetadata tm1 = tmm.unwrapMetaValue(mv);
+
+ assertEquals(tm.getAssociatedSession(), tm1.getAssociatedSession());
+ }
+
+}
Property changes on: branches/7.1.x/client/src/test/java/org/teiid/adminapi/impl/TestTransactionMetadata.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the teiid-commits
mailing list