Changeset 252

Show
Ignore:
Timestamp:
11/06/09 10:45:33 (2 years ago)
Author:
martijn
Message:

Made Picr and PicrRest? comply with basic unit tests

Location:
trunk/picr/src/org/bridgedb/webservice/picr
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/picr/src/org/bridgedb/webservice/picr/IDMapperPicr.java

    r248 r252  
    151151        {                
    152152                Object[] databases; 
    153                 if (tgtDataSources == null)  
     153                if (tgtDataSources.length == 0)  
    154154                        databases = supportedDbObjects; 
    155155                else 
     
    158158                Set<Xref> result = new HashSet<Xref>(); 
    159159                if (databases.length == 0) return result; 
    160                  
     160                if (!supportedDatabases.contains(srcXref.getDataSource())) return result; 
     161 
    161162                List<CrossReference> refs = new ArrayList<CrossReference>(); 
    162163                 
     
    187188                for (DataSource tgt : ds) 
    188189                { 
    189                         if (supportedDatabases.contains(ds)) 
     190                        if (supportedDatabases.contains(tgt)) 
    190191                                databases.add(tgt.getFullName()); 
    191192                } 
     
    210211                        throws IDMapperException  
    211212        { 
     213                Set<String> result = new HashSet<String>(); 
     214                if (!supportedDatabases.contains(ref.getDataSource())) return result; 
     215                 
    212216                List<UPEntry> entries = client.performAccessionMapping(ref.getId(), supportedDbObjects); 
    213                  
    214                 Set<String> result = new HashSet<String>(); 
    215                  
    216217                for (UPEntry entry : entries) 
    217218                { 
     
    249250                        throws IDMapperException  
    250251        { 
     252                Map<String, Set<String>> result = new HashMap<String, Set<String>>(); 
     253                if (!supportedDatabases.contains(ref.getDataSource())) return result; 
     254 
    251255                List<UPEntry> entries = client.performAccessionMapping(ref.getId(), supportedDbObjects); 
    252                  
    253                 Map<String, Set<String>> result = new HashMap<String, Set<String>>(); 
    254                  
    255256                for (UPEntry entry : entries) 
    256257                {                        
  • trunk/picr/src/org/bridgedb/webservice/picr/IDMapperPicrRest.java

    r241 r252  
    111111                                isOnlyActive = Boolean.parseBoolean(args.get("only-active")); 
    112112                        } 
    113                         return new IDMapperPicr(isOnlyActive); 
     113                        return new IDMapperPicrRest(isOnlyActive); 
    114114                } 
    115115        } 
     
    190190            // remove unsupported data sources 
    191191            Set<String> tgtDss = new HashSet<String>(); 
    192             if (tgtDataSources!=null) { 
     192            if (tgtDataSources.length > 0) { 
    193193                for (DataSource ds : tgtDataSources) { 
    194194                    if (supportedDatabases.contains(ds)) {