Newer
Older
import it.inaf.oats.ia2.tapschemamanager.businesslayer.Column;
import it.inaf.oats.ia2.tapschemamanager.businesslayer.CredentialsConfiguration;
import it.inaf.oats.ia2.tapschemamanager.businesslayer.SeparateCredentials;
import it.inaf.oats.ia2.tapschemamanager.datalayer.ColumnEntity;
import it.inaf.oats.ia2.tapschemamanager.datalayer.Credentials;
import java.io.StringReader;
import java.io.StringWriter;
import javax.xml.bind.JAXB;
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.Ignore;
/**
*
* @author Sonia Zorba <zorba at oats.inaf.it>
*/
public class TapSchemaMangerTest {
public TapSchemaMangerTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Ignore
@Test
public void testEditingFieldValue() {
// ColumnEntity columnEntity = new ColumnEntity("test");
// columnEntity.setDescription("desc");
// columnEntity.setUnit(null);
// columnEntity.setStd(0);
//
// Column column = new Column(columnEntity, false);
//
// String key = Column.DESCRIPTION;
// assertFalse(column.isChanged(key));
// column.setValue(key, "mod");
// assertTrue(column.isChanged(key));
// column.setValue(key, "desc");
// assertFalse(column.isChanged(key));
//
// key = Column.UNIT;
// assertFalse(column.isChanged(key));
// column.setValue(key, "xxx");
// assertTrue(column.isChanged(key));
// column.setValue(key, "");
// assertFalse(column.isChanged(key));
//
// key = Column.STD;
// assertFalse(column.isChanged(key));
// column.setValue(key, "1");
// assertTrue(column.isChanged(key));
// column.setValue(key, "0");
// assertFalse(column.isChanged(key));
}
@Test
public void testCredentialsConfigSerialization() throws Exception {
CredentialsConfiguration cc = new CredentialsConfiguration();
cc.addCredentials(new Credentials());
SeparateCredentials sc = new SeparateCredentials();
sc.setSourceCredentials(new Credentials());
sc.setTapSchemaCredentials(new Credentials());
cc.addSeparateCredentials(sc);
StringWriter sw = new StringWriter();
JAXB.marshal(cc, sw);
StringReader sr = new StringReader(sw.toString());
cc = JAXB.unmarshal(sr, CredentialsConfiguration.class);
sw = new StringWriter();
JAXB.marshal(cc, sw);
System.out.println(sw);
}