Ignore:
Timestamp:
08/05/20 09:42:15 (4 years ago)
Author:
bart
Message:

Added BOA support, some bug fixes

Location:
protocol/src/test/java/geniusweb/protocol
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • protocol/src/test/java/geniusweb/protocol/session/DefaultSessionStateTest.java

    r10 r20  
    139139        }
    140140
     141        @Override
     142        public SessionResult getResult() {
     143
     144                List<Double> emptylist = new LinkedList<>();
     145                for (int n = 0; n < getConnections().size(); n++)
     146                        emptylist.add(0d);
     147                return new SessionResult(getSettings().getAllParties(), getAgreement(),
     148                                emptylist, getError());
     149
     150        }
     151
    141152}
  • protocol/src/test/java/geniusweb/protocol/session/SessionResultTest.java

    r8 r20  
    1919import geniusweb.issuevalue.DiscreteValue;
    2020import geniusweb.issuevalue.Value;
    21 import geniusweb.protocol.SessionResult;
    2221import geniusweb.references.Parameters;
    2322import geniusweb.references.PartyRef;
     
    3231
    3332        private final String ISSUE1 = "issue1";
    34         private SessionResult result1, result1a, result2, result3;// , result4;
     33        private SessionResult result1, result1a, result2, result3, result4;
    3534        private String errorstring; // created dynamically: eclipse and maven
    3635                                                                // generate different stacktrace.
    37         private String jsonstring = "{\"participants\":[{\"party\":{\"partyref\":\"party1\",\"parameters\":{}},\"profile\":\"profile1\"},{\"party\":{\"partyref\":\"party2\",\"parameters\":{}},\"profile\":\"profile2\"}],\"agreement\":{\"issuevalues\":{\"issue1\":\"a\"}},\"error\":null}";
     36        private String jsonstring = "{\"participants\":[{\"party\":{\"partyref\":\"party1\",\"parameters\":{}},\"profile\":\"profile1\"},{\"party\":{\"partyref\":\"party2\",\"parameters\":{}},\"profile\":\"profile2\"}],\"agreement\":{\"issuevalues\":{\"issue1\":\"a\"}},\"penalties\":[0.0,0.0],\"error\":null}";
     37        private List<Double> nopenalties = Arrays.asList(0d, 0d);
     38        private List<Double> penalties = Arrays.asList(0.1d, 0.2d);
    3839
    3940        @Before
     
    6364
    6465                result1 = new SessionResult(Arrays.asList(partyprofile1, partyprofile2),
    65                                 bid1, null);
     66                                bid1, nopenalties, null);
    6667                result1a = new SessionResult(
    67                                 Arrays.asList(partyprofile1, partyprofile2), bid1, null);
     68                                Arrays.asList(partyprofile1, partyprofile2), bid1, nopenalties,
     69                                null);
    6870                result2 = new SessionResult(Arrays.asList(partyprofile1, partyprofile2),
    69                                 bid2, null);
     71                                bid2, nopenalties, null);
    7072                result3 = new SessionResult(Arrays.asList(partyprofile2, partyprofile1),
    71                                 bid2, null);
     73                                bid2, nopenalties, null);
     74                result4 = new SessionResult(Arrays.asList(partyprofile2, partyprofile1),
     75                                bid2, penalties, null);
     76
    7277                // IGNORE ERROR for now, it fails somewhere deep in maven suddenly.
    7378                // result4 = new SessionResult(Arrays.asList(partyprofile1,
     
    7883        public List<List<SessionResult>> getGeneralTestData() {
    7984                return Arrays.asList(Arrays.asList(result1, result1a),
    80                                 Arrays.asList(result2), Arrays.asList(result3)
    81                 // ,Arrays.asList(result4)
    82                 );
     85                                Arrays.asList(result2), Arrays.asList(result3),
     86                                Arrays.asList(result4));
    8387        }
    8488
     
    8690        public List<String> getGeneralTestStrings() {
    8791                return Arrays.asList(
    88                                 "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"a\".*null.",
    89                                 "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"b\".*null.*",
    90                                 "SessionResult.*party2.*profile2.*,.*party1.*profile1.*Bid.*issue1=\"b\".*null.*"
    91                 // ,"SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"a\".*null.*"
     92                                "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"a\".*0\\.0.*0\\.0.*null.*",
     93                                "SessionResult.*party1.*profile1.*,.*party2.*profile2.*Bid.*issue1=\"b\".*0\\.0.*0\\.0.*null.*",
     94                                "SessionResult.*party2.*profile2.*,.*party1.*profile1.*Bid.*issue1=\"b\".*0\\.0.*0\\.0.*null.*",
     95                                "SessionResult.*party2.*profile2.*,.*party1.*profile1.*Bid.*issue1=\"b\".*0\\.1.*0\\.2.*null.*"
    9296
    9397                );
  • protocol/src/test/java/geniusweb/protocol/session/shaop/SHAOPStateTest.java

    r18 r20  
    3131import geniusweb.protocol.partyconnection.ProtocolToPartyConn;
    3232import geniusweb.protocol.partyconnection.ProtocolToPartyConnections;
     33import geniusweb.protocol.session.SessionResult;
    3334import geniusweb.protocol.session.TeamOfPartiesAndProfiles;
    3435import tudelft.utilities.junit.GeneralTests;
     
    314315        }
    315316
     317        @Test
     318        public void getResultTest() {
     319
     320                Map<PartyId, Double> spent = new HashMap<>();
     321                spent.put(party1, 0.1d);
     322                SHAOPState state = new SHAOPState(actions, connections4,
     323                                new ProgressRounds(10, 0, null), settings, null, 0, partynrs,
     324                                spent);
     325                SessionResult res = state.getResult();
     326
     327        }
     328
    316329}
  • protocol/src/test/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsProtocolTest.java

    r10 r20  
    2323import geniusweb.protocol.CurrentNegoState;
    2424import geniusweb.protocol.NegoState;
    25 import geniusweb.protocol.SessionResult;
    2625import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
    2726import geniusweb.protocol.session.SessionProtocol;
     27import geniusweb.protocol.session.SessionResult;
    2828import geniusweb.protocol.session.SessionSettings;
    2929import geniusweb.protocol.session.SessionState;
     
    4646        private Bid agreement = mock(Bid.class);
    4747        private final long NOW = 1000;
     48        private SessionResult finalstate = mock(SessionResult.class);
    4849
    4950        @Before
     
    5354                when(finalsessionstate.getSettings()).thenReturn(settings);
    5455                when(finalsessionstate.getAgreement()).thenReturn(agreement);
     56                when(finalsessionstate.getResult()).thenReturn(finalstate);
     57                when(finalstate.getAgreement()).thenReturn(agreement);
    5558                when(state.with(any())).thenReturn(newstate);
    5659        }
  • protocol/src/test/java/geniusweb/protocol/tournament/allpermutations/AllPermutationsStateTest.java

    r10 r20  
    1313import org.junit.Test;
    1414
    15 import geniusweb.protocol.SessionResult;
     15import geniusweb.protocol.session.SessionResult;
    1616import geniusweb.protocol.session.SessionSettings;
    1717import geniusweb.references.PartyWithProfile;
Note: See TracChangeset for help on using the changeset viewer.