*/
public void registerFileFormat(FileFormatI format)
{
- registerFileFormat(format, false);
+ boolean isIdentifiable = format instanceof FileFormat
+ && ((FileFormat) format).isIdentifiable();
+ registerFileFormat(format, isIdentifiable);
}
protected void registerFileFormat(FileFormatI format,
@Override
public List<String> getURLEncodedParameter()
{
- ArrayList<String> prms = new ArrayList<String>();
- prms.add("format='" + format + "'");
+ List<String> prms = new ArrayList<String>();
+ prms.add("format='" + format.getName() + "'");
if (type != null)
{
prms.add("type='" + type.toString() + "'");
}
@Test(groups = "Functional")
- public void testIsDynamic()
+ public void testIsIdentifiable()
{
FileFormats formats = FileFormats.getInstance();
- for (FileFormatI ff : FileFormat.values())
- {
- assertFalse(formats.isIdentifiable(ff));
- }
- assertTrue(formats.isIdentifiable(null));
+ assertTrue(formats.isIdentifiable(formats.forName(FileFormat.Fasta
+ .getName())));
+ assertTrue(formats.isIdentifiable(formats.forName(FileFormat.MMCif
+ .getName())));
+ assertTrue(formats.isIdentifiable(formats.forName(FileFormat.Jnet
+ .getName())));
+ assertFalse(formats.isIdentifiable(formats.forName(FileFormat.Jalview
+ .getName())));
+ assertFalse(formats.isIdentifiable(null));
/*
- * remove and re-add a format: it is now considered 'dynamically added'
+ * remove and re-add a format: it is still 'identifiable'
*/
formats.deregisterFileFormat(FileFormat.Fasta.getName());
assertNull(formats.forName(FileFormat.Fasta.getName()));
FileFormats formats = FileFormats.getInstance();
assertSame(FileFormat.MMCif,
formats.forName(FileFormat.MMCif.getName()));
- assertFalse(formats.isIdentifiable(FileFormat.MMCif));
+ assertTrue(formats.isIdentifiable(FileFormat.MMCif));
/*
* deregister mmCIF format
/*
* re-register mmCIF format
- * it is reinstated (but now classed as 'dynamic')
+ * it is reinstated (still 'identifiable')
*/
formats.registerFileFormat(FileFormat.MMCif);
assertSame(FileFormat.MMCif,