-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from CST-Group/improve-disconnected-codelet-me…
…ssage Improving the disconnected Codelet message to cite Codelet's name
- Loading branch information
Showing
4 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
src/main/java/br/unicamp/cst/core/exceptions/MemoryObjectNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* | ||
*/ | ||
package br.unicamp.cst.core.exceptions; | ||
|
||
/** | ||
* This class represents a Java exception to be thrown when the access memory object | ||
* method is not capable of finding the corresponding memory object | ||
* | ||
* @author andre | ||
* | ||
*/ | ||
public class MemoryObjectNotFoundException extends Exception { | ||
|
||
/** | ||
* | ||
*/ | ||
private static final long serialVersionUID = -6845401281653737754L; | ||
|
||
/** | ||
* | ||
*/ | ||
public MemoryObjectNotFoundException() { | ||
} | ||
|
||
/** | ||
* @param message | ||
*/ | ||
public MemoryObjectNotFoundException(String message) { | ||
super(message); | ||
} | ||
|
||
/** | ||
* @param cause | ||
*/ | ||
public MemoryObjectNotFoundException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
/** | ||
* @param message | ||
* @param cause | ||
*/ | ||
public MemoryObjectNotFoundException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
/** | ||
* @param message | ||
* @param cause | ||
* @param enableSuppression | ||
* @param writableStackTrace | ||
*/ | ||
public MemoryObjectNotFoundException(String message, Throwable cause, boolean enableSuppression, | ||
boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/br/unicamp/cst/core/entities/DisconnectedCodeletTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* | ||
*/ | ||
package br.unicamp.cst.core.entities; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
/** | ||
* @author andre | ||
* | ||
*/ | ||
public class DisconnectedCodeletTest { | ||
|
||
@Test | ||
public void testDisconnectedCodelet() { | ||
|
||
Codelet disconnectedCodelet = new Codelet() { | ||
|
||
@Override | ||
public void accessMemoryObjects() { | ||
} | ||
|
||
@Override | ||
public void proc() { | ||
|
||
} | ||
|
||
@Override | ||
public void calculateActivation() { | ||
|
||
} | ||
}; | ||
disconnectedCodelet.setName("Disconnected Codelet"); | ||
disconnectedCodelet.start(); | ||
|
||
try { | ||
disconnectedCodelet.getInput("TYPE", 0); | ||
}catch(Exception e) { | ||
assertEquals(e.getMessage(), "This Codelet could not find a memory object it needs: Disconnected Codelet"); | ||
} | ||
} | ||
|
||
} |