pizza party application sample and regression test an overview
TRANSCRIPT
![Page 1: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/1.jpg)
Pizza Party Application
Sample and Regression Test
An Overview
![Page 2: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/2.jpg)
The Pizza Party
• This application (COUGAAR_INSTALL_PATH/pizza) is a good introduction to Cougaar features, and helps ensure all features are working in new releases.
• It shows Plugins, Tasks and Allocations, Assets, Property Groups, Relays, Communities, ABAs, Yellow Pages, Service Discovery, Servlets, Alarms, …
![Page 3: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/3.jpg)
The Story• Alice is throwing a pizza party• She invites the friends on her FriendsOfMark buddy list• They are Carnivores or Vegetarians, and tell her the kind of pizza they want• After waiting for RSVPs, she wants to order the pizza• She then does Service Discovery, to look in the Yellow Pages for PizzaProviders
– In the non-SD version, she has a single relationship with Joes
• She finds a provider (Joes), and sends a 2-party order– Meat and Veggie
• Joes does not sell Veggie pizza, so that part of the order fails– In the non-SD version, Alice has failed – her friends will not be happy!
• Alice wants to order from just one place, so rescinds the order• She goes back to the Yellow Pages, specifying she doesn’t want Joes• Having looked in Cambridge, she expands her search to the overall MA Yellow Pages, and
finds Dominos.• Alice re-sends her order to Dominos• Dominos is happy to sell her the pizza• The party is on!
![Page 4: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/4.jpg)
The Configuration Files…
![Page 5: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/5.jpg)
Nodes and Agents
MAJoe’s
Tony Mark
SDPizzaNode2
Alice
CambridgeDominos
Bob
SDPizzaNode1
There is one “society.xml” file per Node. See pizza/configs/pizzaparty for SDPizzaNode1 and SDPizzaNode2.xml
![Page 6: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/6.jpg)
Pizza Communities
Alice
MA
Joe’s
Tony Mark
CambridgeDominos
Bob
MA YP Community
Friends of Mark Community
YP Server, Comm Manager
YP Server, Comm Manager
Pizza Provider
Pizza Provider
Cambridge YP Community
Comm Manager, Pizza Client
Defined in communities.xml
![Page 7: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/7.jpg)
Other Configuration Data
• The 2 Node’s list a bunch of VM parameters (-D arguments)– Where the White Pages will run– COUGAAR_INSTALL_PATH– Log Service Config file
• LDMDomains.ini lists Domains– We user Pizza and ServiceDiscovery
![Page 8: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/8.jpg)
Society Startup Sequence
![Page 9: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/9.jpg)
Community Initialization
MA
Joe’s
Tony Mark
Alice
CambridgeDominos
Bob
Comm JoinComm Join (whole community)
Comm Join Comm Join
Comm Join
CommunityPlugin does the work
![Page 10: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/10.jpg)
Service Discovery Initialization
MA
Joe’s
CambridgeDominos
Register as PizzaProvider
Register as PizzaProvider
Publish Taxonomy
Publish Taxonomy
See the SDRegistrationPlugin and PublishTaxonomy plugins
(Additionally, each Agent’s AssetDataParamPlugin creates a local self Entity Asset)
![Page 11: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/11.jpg)
Entity Asset Creation
Joe’s
Tony Mark
Alice
Dominos
Bob
AssetDataParamPlugin creates a local self Entity Asset, representing the local Person or Store. It is used for Relationships (like PizzaProvider), and tells people the kind of pizza they like (Meat or Veggie).
Store - Dominos
Person – Alice
Vegetarian
Store - Joes
Person – Mark
Vegetarian
Person – Tony
CarnivorePerson – Bob
Carnivore
![Page 12: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/12.jpg)
Prototype Registration
Joe’s
Dominos
Alice
PizzaPrototypePI
KitchenPrototypePI
KitchenPrototypePI
Register the Store’s Kitchen, with a PropertyGroup indicating the kind of Pizza they make
Register a prototype Pizza Asset, for use as the DirectObject on the Order Task
![Page 13: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/13.jpg)
Now the Application Run Flow
![Page 14: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/14.jpg)
Step 1: Invite to Party
MA
Joe’s
Tony Mark
Alice
CambridgeDominos
Bob
InvitePI
Publish Invitation Relay with ABA target “FriendsOfMark”
InvitationAlice gets own invite
ABA Expanded, Relay sent to all Targets
![Page 15: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/15.jpg)
Step 2: Find Food Preference
MA
Joe’s
Tony Mark
Alice
CambridgeDominos
Bob
Invitation
Invitation Invitation Invitation
Self: Meat or Veggie PG?
RSVPPI
RSVP Plugin checks self Entity’s PGs and puts Response on Relay of Meat or Veggie Preference
![Page 16: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/16.jpg)
Step 3: Collect Incoming Replies
MA
Joe’s
Tony Mark
Alice
CambridgeDominos
BobInvitation Invitation Invitation
Relay responses when published are auto sent back to Alice
PizzaPreferences: 2 Meat, 2 Veggie
Relay Responses
Relay Source auto-updates the collected PizzaPreferences
![Page 17: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/17.jpg)
Step 4: Publish PizzaPreferences
MA
Joe’s
Tony Mark
Alice
CambridgeDominos
BobInvitation Invitation Invitation
Invite Plugin then publishes a PizzaPreferences object, which the PlaceOrderPI subscribes to InvitePI
Pizza Preferences: 2 Meat, 2 Veggie
SDPlaceOrderPI
![Page 18: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/18.jpg)
Step 5: Create Orders
MA
Joe’s
Tony Mark
Alice
CambridgeDominos
BobInvitation Invitation Invitation
SDPlaceOrder Plugin publishes a Task: “Order Pizza”, and expands that for each kind of Pizza needed
SDPlaceOrderPI
Task: Order 2 Meat
Task: Order 2 Veggie
Task: Order Pizza
![Page 19: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/19.jpg)
Step 6: Ask for ProvidersPublish FindProviders with Role Pizza Provider. SDClientPlugin passes an MMQuery to the MatchmakerPlugin.
Alice
SDPlaceOrderPI
Task: FindProviders: PizzaProvider
SDClientPI MatchmakerPI
MMQuery: PizzaProvider
![Page 20: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/20.jpg)
MA
Cambridge
Dominos
Step 7: Query Yellow PagesMatchmakerPlugin asks CommunityService for it’s YP Community.
Then it issues a YP Query for a registered PizzaProvider. That query will look in the local YP first. If it can’t find a match, it looks in the next higher YP (parent Community).
When an answer comes back, it is scored with the RoleWithBlacklistScorer – if it’s the right Role, without being on the Blacklist, we use it. The answer goes back to the SDClientPlugin
Joe’s
MatchmakerPI
CommunityService
YP?Cambridge-YPCommunity
Alice
PizzaProvider? Joes
![Page 21: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/21.jpg)
Step 8: Establish RelationshipThe SDClientPlugin sends a ServiceContractRelay to the named Provider.
The AgreeableProviderPlugin at Joes just says yes, attaching a Contract.
The ServiceContractLP sees the Contract, and fills in a Relationship on the local self Entity on each end of the relationship.
The SDClientPlugin, having gotten a Contract, Disposes the FindProviders Task as successfully complete.
Joe’s
Alice
SDClientPI
AgreeableProviderPI
ServiceContractRelay
Contract
Relationship: Joes/PizzaProvider
Relationship: Alice/PizzaConsumer
FindProviders: Success Disposition
![Page 22: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/22.jpg)
Step 9: Allocate TasksThe SDPlaceOrderPlugin, having finished FindProviders, gets the Provider off it’s Relationship Schedule on the self Entity, and Allocates the 2 Order Tasks to that Entity.
The infrastructure sees this Allocation to an Entity, and copies the Task at the other Entity – Joes.
Alice
SDPlaceOrderPI Relationship: Joes/PizzaProvider
FindProviders: Success Disposition
Task: Order 2 Meat
Task: Order 2 Veggie
Joe’s
Allocation: JoesAllocation: Joes
![Page 23: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/23.jpg)
Step 10:Match Capabilities
Joe’sAlice ProcessOrderPI
Task: Order 2 Meat
Task: Order 2 Veggie
Kitchen - Meat
Allocation: PASS
Allocation: FAIL
At Joes, the ProcessOrderPlugin sees 2 new Order Tasks. It Allocates them to the local Kitchen Asset.
It looks at the local Kitchen Asset to match the Meat / Veggie toppings requested on the DirectObject of the Order Task. If its Kitchen has matching capabilities, the Task gets a Success Result, otherwise it says it will deliver 0 pizzas, and gives it a Failure Result.
The infrastructure copies those results back to Alice (where the Tasks came from).
![Page 24: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/24.jpg)
Step 11: Done?
If the Provider (Joes) filled the Orders (he didn’t) Alice would be done.
Otherwise, the SDPlaceOrderPlugin rescinds the Allocations (Alice wants to order all pizza from one store), and must issue a new FindProviders Task, asking for a new provider, other than Joes.
Now, we repeat steps 6-11. This time, we get Dominos, and the party is on!
![Page 25: Pizza Party Application Sample and Regression Test An Overview](https://reader036.vdocuments.mx/reader036/viewer/2022062408/56649ea15503460f94ba45fd/html5/thumbnails/25.jpg)
What Next?
• Have you read the documentation? (Online at http://tutorials.cougaar.org/pizza )
• Read through the javadoc (Online at http://cougaar.cougaar.org/software/latest/javadoc/pizza/doc/api/ )
• Read through the config files (pizza/configs/pizzaparty – see the Readme)
• Try modifying the application– Add a friend– Make Joes serve Veggie Pizza