I wrote a Jython class that inherits from a Java class and (thats the
plan) overrides one method. Everything should stay the same.
If I run this nothing happens whereas if I run the Java class it says:
usage: java fit.FitServer [-v] host port socketTicket
-v verbose
I think this is because I do not understand the jython mechanism for
inheritance (yet).
JyFitServer.py:
===========
import fit.FitServer
import fitnesse.compon ents.FitProtoco l
from fit.Parse import Parse
from fit.Fixture import Fixture
# Inherit from original Java FitServer Implementation by Robert C.
Martin and Micah D. Martin
class FitServer(fit.F itServer):
# call constructor of superclass
def __init__(self, host, port, verbose):
FitServer.__ini t__(self, host, port, verbose)
# override process method
def process(self):
self.fixture.li stener = self.fixtureLis tener
print "hello, I am JyFitServer!"
try:
size = FitProtocol.rea dSize(self.sock etReader)
if size > 0:
try:
document =
FitProtocol.rea dDocument(self. socketReader, size)
tables = Parse(document)
fixture = Fixture()
fixture.listene r = self.fixtureLis tener;
fixture.doTable s(tables)
self.counts.tal ly(self.fixture .counts)
except FitParseExcepti on, e:
self.exception( e)
except Exception, e:
self.exception( e)
Please help,
Mark Fink
plan) overrides one method. Everything should stay the same.
If I run this nothing happens whereas if I run the Java class it says:
usage: java fit.FitServer [-v] host port socketTicket
-v verbose
I think this is because I do not understand the jython mechanism for
inheritance (yet).
JyFitServer.py:
===========
import fit.FitServer
import fitnesse.compon ents.FitProtoco l
from fit.Parse import Parse
from fit.Fixture import Fixture
# Inherit from original Java FitServer Implementation by Robert C.
Martin and Micah D. Martin
class FitServer(fit.F itServer):
# call constructor of superclass
def __init__(self, host, port, verbose):
FitServer.__ini t__(self, host, port, verbose)
# override process method
def process(self):
self.fixture.li stener = self.fixtureLis tener
print "hello, I am JyFitServer!"
try:
size = FitProtocol.rea dSize(self.sock etReader)
if size > 0:
try:
document =
FitProtocol.rea dDocument(self. socketReader, size)
tables = Parse(document)
fixture = Fixture()
fixture.listene r = self.fixtureLis tener;
fixture.doTable s(tables)
self.counts.tal ly(self.fixture .counts)
except FitParseExcepti on, e:
self.exception( e)
except Exception, e:
self.exception( e)
Please help,
Mark Fink
Comment