We don't know what you are actually trying to do.
WHICH book has the problem you are trying to solve?
I spent some time looking at the code in your repository,
and the KA* classes look very "passive".  I don't really
see any simulation going on anywhere but in the test
cases, and that just feels wrong.

I would expect a network simulator to model network nodes
as Processes with SharedQueues of messages coming in
and responding by sending messages through other SharedQueues.

On Wed, 30 Oct 2019 at 19:34, Roelof Wobben via Pharo-users
<pharo-users@lists.pharo.org> wrote:
>
> Thanks,
>
> That part I understand  but what I try  to say is that if I understand
> the code right the string BALL  is send back to the node that send the
> orginal messsgae #ball.  But as I said that one do not seem to recieve
> any packages and my question is still why ?
>
> I debugged it several times but I do not see the reason.
>
> Roelof
>
>
>
> Op 30-10-2019 om 01:38 schreef Richard O'Keefe:
> > The first question you should ask is "What do I expect #ball asUppercase to 
> > be?"
> > The ANSI Smalltalk standard says
> > 5.7.10.9 Message:  asUppercase
> > Synopsis
> >    Answer a new string which contains all of the elements of the
> > receiver converted to their upper
> > case equivalents.
> > Definition: <readableString>
> >    Answer a new string which contains all of the elements of the
> > receiver converted to their upper
> > case equivalents. Individual element of the string are converted as if
> > they were receivers of the
> > message #asUppercase.
> > Return Values
> >    <readableString> new
> > Errors
> >    none
> >
> > Notice the word "string", the protocol "<readableString>", and the
> > entire absence of anything
> > suggesting that the receiver and result belong to the same class.
> >
> > In my Smalltalk library, the receiver and result DO belong to the same 
> > class,
> > so #ball asUppercase ==> #BALL.
> > But the ANSI standard does not require that.
> > And I may change my library, because
> > GNU Smalltalk, Dolphin Smalltalk, Smalltalk/X, Squeak, and Pharo
> > all return a String.  (On the other hand, one reason I wrote my Smalltalk
> > was to press the edges of the ANSI standard, so maybe I'll leave it.)
> >
> > So I think where you have #BALL you should have 'BALL'.
> > There may be other issues.
> >
> > On Wed, 30 Oct 2019 at 11:00, Roelof Wobben via Pharo-users
> > <pharo-users@lists.pharo.org> wrote:
> >> Hello,
> >>
> >> I have to  made this challenge as last on of the OOP book
> >>
> >> Servers answering requests
> >>
> >> When a server node consumes a packet, it converts the payload to uppercase,
> >> then sends that back to the sender of the request.
> >>
> >> This is yet another subclass which redefines the consume: method, but this
> >> time the node is stateless, so we have no initialization or accessor 
> >> methods to
> >> write:
> >>
> >> KANetworkNode subclass: #KANetworkServer
> >> instanceVariableNames: ''
> >> classVariableNames: ''
> >> category: 'NetworkSimulator-Nodes'
> >>
> >> KANetworkServer >> consume: aPacket
> >> | response |
> >> response := aPacket payload asUppercase.
> >> self send: (KANetworkPacket
> >> from: self address
> >> to: aPacket sourceAddress
> >> payload: response)
> >>
> >>
> >> Define a test for the behavior of server nodes.
> >>
> >>
> >> I tried but I miss something
> >>
> >> so far as I have this :
> >>
> >> testSendToServer
> >>      | packet ping pong link |
> >>      packet := KANetworkPacket from: #ping to: #pong payload: #ball.
> >>      ping := net nodeAt: #ping.
> >>      pong := net nodeAt: #pong.
> >>      link := net linkFrom: #ping to: #pong.
> >>      ping send: packet.
> >>      pong consume: packet.
> >>
> >> but whatever I tried I cannot think of a test that works.
> >>
> >> I tried
> >>
> >> assert:  ping payload equals: #BALL
> >> assert: ping arrievedpackages equals; 1
> >>
> >> but they all fail
> >>
> >> It looks like ping does not recieve the package back.
> >>
> >> What do I do wrong or what can I test better ?
> >>
> >> my code so far : https://github.com/RoelofWobben/network
> >>
> >> and the problem is the testToServerTest that I cannot make work
> >>
> >> Regards,
> >>
> >> Roelof
> >>
>
>

Reply via email to