Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
f6e7573f
Commit
f6e7573f
authored
Jul 25, 2019
by
Piotr Gawron
Browse files
single column data doesn't use columns
parent
11936eac
Changes
2
Hide whitespace changes
Inline
Side-by-side
service/src/main/java/lcsb/mapviewer/services/utils/ColorSchemaReader.java
View file @
f6e7573f
...
...
@@ -819,17 +819,19 @@ public class ColorSchemaReader {
line
=
br
.
readLine
();
}
String
[]
columns
=
line
.
split
(
"\t"
);
if
(
columns
.
length
>
1
)
{
Map
<
ColorSchemaColumn
,
Integer
>
schemaColumns
=
new
HashMap
<>();
parseColumns
(
columns
,
schemaColumns
,
ColorSchemaType
.
GENERIC
);
for
(
ColorSchemaColumn
column
:
schemaColumns
.
keySet
())
{
try
{
Field
f
=
ColorSchemaColumn
.
class
.
getField
(
column
.
name
());
if
(
column
.
getDepractedColumnName
()
!=
null
||
f
.
isAnnotationPresent
(
Deprecated
.
class
))
{
result
.
add
(
column
);
Map
<
ColorSchemaColumn
,
Integer
>
schemaColumns
=
new
HashMap
<>();
parseColumns
(
columns
,
schemaColumns
,
ColorSchemaType
.
GENERIC
);
for
(
ColorSchemaColumn
column
:
schemaColumns
.
keySet
())
{
try
{
Field
f
=
ColorSchemaColumn
.
class
.
getField
(
column
.
name
());
if
(
column
.
getDepractedColumnName
()
!=
null
||
f
.
isAnnotationPresent
(
Deprecated
.
class
))
{
result
.
add
(
column
);
}
}
catch
(
NoSuchFieldException
|
SecurityException
e
)
{
throw
new
InvalidStateException
(
e
);
}
}
catch
(
NoSuchFieldException
|
SecurityException
e
)
{
throw
new
InvalidStateException
(
e
);
}
}
}
...
...
service/src/test/java/lcsb/mapviewer/services/utils/ColorSchemaReaderTest.java
View file @
f6e7573f
...
...
@@ -2,11 +2,10 @@ package lcsb.mapviewer.services.utils;
import
static
org
.
junit
.
Assert
.*;
import
java.awt.
*
;
import
java.awt.
Color
;
import
java.io.*
;
import
java.nio.charset.StandardCharsets
;
import
java.util.*
;
import
java.util.List
;
import
org.apache.commons.io.output.ByteArrayOutputStream
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -16,6 +15,7 @@ import org.junit.*;
import
lcsb.mapviewer.commands.ColorExtractor
;
import
lcsb.mapviewer.commands.ColorModelCommand
;
import
lcsb.mapviewer.common.TextFileUtils
;
import
lcsb.mapviewer.model.cache.UploadedFileEntry
;
import
lcsb.mapviewer.model.map.MiriamData
;
import
lcsb.mapviewer.model.map.layout.*
;
import
lcsb.mapviewer.model.map.model.Model
;
...
...
@@ -326,4 +326,12 @@ public class ColorSchemaReaderTest extends ServiceTestFunctions {
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
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment