Skip to content

Commit

Permalink
#3900 entity appears only after SDK received first percepts (including
Browse files Browse the repository at this point in the history
the stakeholders). Changed name and type of EIS entities to match
actual. Updated manual.
  • Loading branch information
Wouter1 committed May 10, 2016
1 parent 2ff61ca commit b2c8390
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions doc/src/main/latex/TygronManual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ \subsection{Init parameters}
\end{tabularx}\\


\subsection{Entities}
The entities appear slightly after init has been called. How quick depends on network and server speeds.
Entities get a name corresponding to the stakeholder type, e.g. "Municipality". The type of all entities is "stakeholder".
Only entites matching the requested STAKEHOLDER init parameter will appear.

%%%----------------------------------------------------------
\section{Percepts}
%%%----------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion environment/src/main/java/tygronenv/EisEnv.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public boolean isStateTransitionValid(EnvironmentState oldState, EnvironmentStat
* @throws EntityException
*/
public void entityReady(String entity) throws EntityException {
addEntity(entity);
addEntity(entity, "stakeholder");
}

/************************* SUPPORT FUNCTIONS ****************************/
Expand Down
2 changes: 1 addition & 1 deletion environment/src/main/java/tygronenv/TygronEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void notifyReady(String entity) throws EntityException {
joinedConfirm.client.getClientToken());
slotConnection.fireServerEvent(true, LogicEventType.SETTINGS_ALLOW_INTERACTION, true);

environment.entityReady(entity);
environment.entityReady(stakeholder.getName());
}

/**
Expand Down
3 changes: 2 additions & 1 deletion environment/src/test/java/tygronenv/MyEnvListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ public void handleNewEntity(String entity) {
this.entity = entity;
}

public void waitForEntity() throws InterruptedException {
public String waitForEntity() throws InterruptedException {
while (entity == null) {
Thread.sleep(200);
}
return entity;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void testEntityAppears()
Thread.sleep(5000); // give system sufficient time to create the entity.

// after the init, a new entity should appear that we can connect to.
verify(envlistener).handleNewEntity(ENTITY);
verify(envlistener).handleNewEntity("Municipality");

}

Expand Down Expand Up @@ -163,8 +163,7 @@ private void joinAsMunicipality() throws ManagementException, InterruptedExcepti
// any slot so not specified.
env.init(parameters);

listener.waitForEntity();

assertEquals("Municipality", listener.waitForEntity());
}

/**
Expand Down

0 comments on commit b2c8390

Please sign in to comment.