Commit f6e7573f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

single column data doesn't use columns

parent 11936eac
...@@ -819,17 +819,19 @@ public class ColorSchemaReader { ...@@ -819,17 +819,19 @@ public class ColorSchemaReader {
line = br.readLine(); line = br.readLine();
} }
String[] columns = line.split("\t"); String[] columns = line.split("\t");
if (columns.length > 1) {
Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>(); Map<ColorSchemaColumn, Integer> schemaColumns = new HashMap<>();
parseColumns(columns, schemaColumns, ColorSchemaType.GENERIC); parseColumns(columns, schemaColumns, ColorSchemaType.GENERIC);
for (ColorSchemaColumn column : schemaColumns.keySet()) { for (ColorSchemaColumn column : schemaColumns.keySet()) {
try { try {
Field f = ColorSchemaColumn.class.getField(column.name()); Field f = ColorSchemaColumn.class.getField(column.name());
if (column.getDepractedColumnName() != null || f.isAnnotationPresent(Deprecated.class)) { if (column.getDepractedColumnName() != null || f.isAnnotationPresent(Deprecated.class)) {
result.add(column); result.add(column);
}
} catch (NoSuchFieldException | SecurityException e) {
throw new InvalidStateException(e);
} }
} catch (NoSuchFieldException | SecurityException e) {
throw new InvalidStateException(e);
} }
} }
} }
......
...@@ -2,11 +2,10 @@ package lcsb.mapviewer.services.utils; ...@@ -2,11 +2,10 @@ package lcsb.mapviewer.services.utils;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.awt.*; import java.awt.Color;
import java.io.*; import java.io.*;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.List;
import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -16,6 +15,7 @@ import org.junit.*; ...@@ -16,6 +15,7 @@ import org.junit.*;
import lcsb.mapviewer.commands.ColorExtractor; import lcsb.mapviewer.commands.ColorExtractor;
import lcsb.mapviewer.commands.ColorModelCommand; import lcsb.mapviewer.commands.ColorModelCommand;
import lcsb.mapviewer.common.TextFileUtils; import lcsb.mapviewer.common.TextFileUtils;
import lcsb.mapviewer.model.cache.UploadedFileEntry;
import lcsb.mapviewer.model.map.MiriamData; import lcsb.mapviewer.model.map.MiriamData;
import lcsb.mapviewer.model.map.layout.*; import lcsb.mapviewer.model.map.layout.*;
import lcsb.mapviewer.model.map.model.Model; import lcsb.mapviewer.model.map.model.Model;
...@@ -326,4 +326,12 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions { ...@@ -326,4 +326,12 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
assertNotNull(schemas.iterator().next().getModelName()); assertNotNull(schemas.iterator().next().getModelName());
} }
@Test
public void testGetDeprecatedColumns() throws Exception {
Layout overlay = new Layout();
UploadedFileEntry file = new UploadedFileEntry();
file.setFileContent("blabla\nbasd\n".getBytes("UTF-8"));
overlay.setInputData(file);
assertEquals(0, reader.getDeprecatedColumns(overlay).size());
}
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment