source: src/test/java/negotiator/config/MultilateralTournamentsConfigurationTest.java@ 50

Last change on this file since 50 was 1, checked in by Wouter Pasman, 6 years ago

Initial import : Genius 9.0.0

File size: 2.4 KB
RevLine 
[1]1package negotiator.config;
2
3import static org.junit.Assert.assertFalse;
4
5import java.io.ByteArrayOutputStream;
6import java.io.File;
7import java.util.ArrayList;
8import java.util.List;
9
10import javax.xml.bind.JAXBException;
11
12import org.junit.Test;
13
14import genius.core.Deadline;
15import genius.core.DeadlineType;
16import genius.core.config.MultilateralTournamentConfiguration;
17import genius.core.config.MultilateralTournamentsConfiguration;
18import genius.core.exceptions.InstantiateException;
19import genius.core.persistent.PersistentDataType;
20import genius.core.repository.MultiPartyProtocolRepItem;
21import genius.core.repository.ParticipantRepItem;
22import genius.core.repository.PartyRepItem;
23import genius.core.repository.ProfileRepItem;
24import genius.core.repository.boa.BoaPartyRepItem;
25
26/**
27 * Try to read n a configuration
28 *
29 */
30public class MultilateralTournamentsConfigurationTest {
31 private final static String RESOURCES = "src/test/resources/";
32
33 @Test
34 public void smokeTest() throws JAXBException {
35
36 File file = new File(RESOURCES + "tournamentconfig.xml");
37 MultilateralTournamentsConfiguration.load(file);
38 }
39
40 @Test
41 public void writeSimpleTournamentConfig() throws InstantiateException {
42 MultiPartyProtocolRepItem protocol = new MultiPartyProtocolRepItem();
43 Deadline deadline2 = new Deadline(180, DeadlineType.ROUND);
44 PartyRepItem mediator = new PartyRepItem("unknown.path");
45 List<ParticipantRepItem> parties = new ArrayList<>();
46
47 parties.add(new PartyRepItem("simple.party"));
48 parties.add(new BoaPartyRepItem("boaparty"));
49
50 List<ProfileRepItem> profiles = new ArrayList<>();
51 List<ParticipantRepItem> partiesB = new ArrayList<>();
52 List<ProfileRepItem> profilesB = new ArrayList<>();
53 int nrepeats = 1;
54 int nparties = 2;
55 boolean repeatParties = false;
56 boolean isRandomSessionOrder = false;
57 PersistentDataType type = PersistentDataType.DISABLED;
58 boolean enablePrint = false;
59 MultilateralTournamentConfiguration config = new MultilateralTournamentConfiguration(protocol, deadline2,
60 mediator, parties, profiles, partiesB, profilesB, nrepeats, nparties, repeatParties,
61 isRandomSessionOrder, type, enablePrint);
62
63 ByteArrayOutputStream out = new ByteArrayOutputStream();
64 config.save(out);
65
66 String result = new String(out.toByteArray());
67 System.out.println(result);
68
69 assertFalse("serialization must not contain xmlns:", result.contains("xmlns:"));
70 assertFalse("serialization must not contain xsi:", result.contains("xsi:"));
71
72 }
73}
Note: See TracBrowser for help on using the repository browser.