Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
196 additions
and
9 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package mesh.services | ||
{ | ||
import mesh.operations.MethodOperation; | ||
import mesh.operations.Operation; | ||
|
||
/** | ||
* A request the executes a block function. The request's result will be the data | ||
* that the block returns. If the block throws an error, the request will fault with | ||
* that error. | ||
* | ||
* @author Dan Schultz | ||
*/ | ||
public class SynchronousRequest extends OperationRequest | ||
{ | ||
/** | ||
* @copy Request#Request() | ||
*/ | ||
public function SynchronousRequest(block:Function = null) | ||
{ | ||
super(function():Operation | ||
{ | ||
return new MethodOperation(block); | ||
}); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package mesh.model | ||
{ | ||
import mesh.Customer; | ||
import mesh.Mesh; | ||
import mesh.Name; | ||
import mesh.services.Request; | ||
|
||
import org.flexunit.assertThat; | ||
import org.hamcrest.object.equalTo; | ||
|
||
public class EntityTests | ||
{ | ||
private var _customer:Customer; | ||
|
||
[Before] | ||
public function setup():void | ||
{ | ||
_customer = new Customer(); | ||
_customer.name = new Name("Jimmy", "Page"); | ||
_customer.age = 67; | ||
_customer.save().execute(); | ||
} | ||
|
||
[Test] | ||
public function testReload():void | ||
{ | ||
var customer:Request = Mesh.service(Customer).find(_customer.id).execute(); | ||
customer.age = 68; | ||
customer.reload().execute(); | ||
|
||
assertThat(customer.age, equalTo(_customer.age)); | ||
assertThat(customer.isDirty, equalTo(false)); | ||
} | ||
} | ||
} |
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