|
From: Bryan T. <tho...@us...> - 2007-04-23 18:58:41
|
Update of /cvsroot/cweb/bigdata/src/test/com/bigdata/service In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv2382/src/test/com/bigdata/service Modified Files: TestMetadataServer0.java Log Message: Refactored the MetadataIndex to extend UnisolatedBTree and put it to some use in the MetadataService and validated aspects of its use in the test case for the metadata service. Index: TestMetadataServer0.java =================================================================== RCS file: /cvsroot/cweb/bigdata/src/test/com/bigdata/service/TestMetadataServer0.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestMetadataServer0.java 23 Apr 2007 17:22:16 -0000 1.2 --- TestMetadataServer0.java 23 Apr 2007 18:58:38 -0000 1.3 *************** *** 48,59 **** package com.bigdata.service; - import java.rmi.RemoteException; import java.util.UUID; import java.util.concurrent.ExecutionException; - import com.bigdata.scaleup.PartitionMetadata; - import net.jini.core.lookup.ServiceID; /** * Test ability to launch, register, discover and use a {@link MetadataService} --- 48,59 ---- package com.bigdata.service; import java.util.UUID; import java.util.concurrent.ExecutionException; import net.jini.core.lookup.ServiceID; + import com.bigdata.io.SerializerUtil; + import com.bigdata.scaleup.IPartitionMetadata; + /** * Test ability to launch, register, discover and use a {@link MetadataService} *************** *** 297,304 **** ServiceID dataService0ID = getServiceID(dataServer0); - // lookup proxy for dataService0 - final IDataService dataService0Proxy = lookupDataService(dataService0ID); - try { /* * This should fail since the index was never registered. --- 297,305 ---- ServiceID dataService0ID = getServiceID(dataServer0); try { + + // lookup proxy for dataService0 + final IDataService dataService0Proxy = lookupDataService(dataService0ID); + /* * This should fail since the index was never registered. *************** *** 330,346 **** /* ! * @todo request the partition for the scale-out index, figure out the ! * data service for that partition, and make sure that an index was ! * created on that data service for the partition. */ ! // @todo encapsulate in method to generate metadata index name. ! byte[] val = metadataServiceProxy.lookup(IDataService.UNISOLATED, ! MetadataService.getMetadataName(indexName), new byte[] {}); ! ! dataService0Proxy.rangeCount(IDataService.UNISOLATED, indexName, null, ! null); } ! } --- 331,373 ---- /* ! * Request the index partition metadata for the initial partition of the ! * scale-out index. */ ! IPartitionMetadata pmd; ! { ! ! byte[] val = metadataServiceProxy.lookup(IDataService.UNISOLATED, ! MetadataService.getMetadataName(indexName), new byte[] {}); ! ! assertNotNull(val); ! ! pmd = (IPartitionMetadata) SerializerUtil.deserialize(val); ! ! } + /* + * Resolve the data service to which the initial index partition was + * mapped and verify that we can invoke an operation on that index on + * that data service (i.e., that the data service recognizes that it + * has an index registered by that name). + */ + { + + ServiceID serviceID = MetadataServer.uuid2ServiceID(pmd.getDataServices()[0]); + + // @todo use lookup cache in a real client. + IDataService proxy = lookupDataService(serviceID); + + /* + * Note: this will throw an exception if the index is not registered + * with this data service. + */ + assertEquals("rangeCount", 0, proxy.rangeCount( + IDataService.UNISOLATED, indexName, null, null)); + + } + } ! } |