From 6907852eb9f46ccf3145be51f36e72839fb49d24 Mon Sep 17 00:00:00 2001 From: Henrik Rentz-Reichert Date: Wed, 18 Jan 2012 10:55:54 +0100 Subject: [generator] bug fix in attribute initialization re-generated integration tests and modellib --- .../jgen_modellib.launch | 12 +++++ .../modellib/Socket/DSocketConfiguration.java | 10 ++--- .../etrice/modellib/Socket/DSocketData.java | 4 +- .../room/basic/service/logging/ALogService.java | 3 +- .../basic/service/logging/InternalLogData.java | 14 +++--- .../src-gen/room/basic/service/logging/Log.java | 5 +-- .../room/basic/service/logging/LogData.java | 51 ---------------------- 7 files changed, 29 insertions(+), 70 deletions(-) create mode 100644 runtime/org.eclipse.etrice.modellib/jgen_modellib.launch delete mode 100644 runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java (limited to 'runtime') diff --git a/runtime/org.eclipse.etrice.modellib/jgen_modellib.launch b/runtime/org.eclipse.etrice.modellib/jgen_modellib.launch new file mode 100644 index 000000000..5074d0e3f --- /dev/null +++ b/runtime/org.eclipse.etrice.modellib/jgen_modellib.launch @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java index 0264da386..175072a53 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java @@ -7,11 +7,11 @@ public class DSocketConfiguration { //--------------------- attributes - protected String serverName = ""; - protected int portNumber = 0; - protected int protocol = 0; - protected boolean checkCookie = false; - protected int mode = 0; + protected String serverName; + protected int portNumber; + protected int protocol; + protected boolean checkCookie; + protected int mode; //--------------------- attribute setters and getters public void setServerName (String serverName) { diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java index 271a460e3..1aedbd300 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java @@ -7,8 +7,8 @@ public class DSocketData { //--------------------- attributes - protected int size = 0; - protected String data = ""; + protected int size; + protected String data; //--------------------- attribute setters and getters public void setSize (int size) { diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java index 37d2e2737..ab8f18141 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java @@ -266,8 +266,7 @@ public class ALogService extends ActorClassBase { p=null; } protected void action_TRANS_opened_TO_opened_BY_internalLoglog_tr1(InterfaceItemBase ifitem, InternalLogData data) { - long s = Long.valueOf(data.timeStamp); - p.println("Timestamp: " + Long.toString(s-tStart) + "ms"); + p.println("Timestamp: " + Long.toString(data.timeStamp-tStart) + "ms"); p.println("SenderInstance: "+ data.sender); p.println("UserString: " + data.userString); p.println("--------------------------------------------------"); diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java index ad18afdf3..752ab503e 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java @@ -7,9 +7,9 @@ public class InternalLogData { //--------------------- attributes - protected String userString = ""; - protected String sender = ""; - protected String timeStamp = ""; + protected String userString; + protected String sender; + protected long timeStamp; //--------------------- attribute setters and getters public void setUserString (String userString) { @@ -24,10 +24,10 @@ public class InternalLogData { public String getSender () { return this.sender; } - public void setTimeStamp (String timeStamp) { + public void setTimeStamp (long timeStamp) { this.timeStamp = timeStamp; } - public String getTimeStamp () { + public long getTimeStamp () { return this.timeStamp; } @@ -39,11 +39,11 @@ public class InternalLogData { // initialize attributes userString = ""; sender = ""; - timeStamp = ""; + timeStamp = 0; } // constructor using fields - public InternalLogData(String userString, String sender, String timeStamp) { + public InternalLogData(String userString, String sender, long timeStamp) { super(); this.userString = userString; this.sender = sender; diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java index 4036df8dc..5faabbb9c 100644 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java +++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java @@ -150,8 +150,7 @@ public class Log { long s; if (logLevel>this.logLevel){ d.userString=userString; - s=System.currentTimeMillis(); - d.timeStamp=Long.toString(s); + d.timeStamp=System.currentTimeMillis(); d.sender=getInstancePath(); if (getPeerAddress()!=null) getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d)); @@ -183,7 +182,7 @@ public class Log { if (getPeerAddress()!=null) getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, data.deepCopy())); } - public void internalLog(String userString, String sender, String timeStamp) { + public void internalLog(String userString, String sender, long timeStamp) { internalLog(new InternalLogData(userString, sender, timeStamp)); } } diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java deleted file mode 100644 index c38358251..000000000 --- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/LogData.java +++ /dev/null @@ -1,51 +0,0 @@ -package room.basic.service.logging; - - - - -public class LogData { - - - //--------------------- attributes - protected int logLevel = 0; - protected String userString = ""; - - //--------------------- attribute setters and getters - public void setLogLevel (int logLevel) { - this.logLevel = logLevel; - } - public int getLogLevel () { - return this.logLevel; - } - public void setUserString (String userString) { - this.userString = userString; - } - public String getUserString () { - return this.userString; - } - - //--------------------- operations - - // default constructor - public LogData() { - super(); - // initialize attributes - logLevel = 0; - userString = ""; - } - - // constructor using fields - public LogData(int logLevel, String userString) { - super(); - this.logLevel = logLevel; - this.userString = userString; - } - - // deep copy - public LogData deepCopy() { - LogData copy = new LogData(); - copy.logLevel = logLevel; - copy.userString = userString; - return copy; - } -}; -- cgit v1.2.3 From ec85fadf44a27b77b29883c7b902902e2d432155 Mon Sep 17 00:00:00 2001 From: tjung Date: Tue, 24 Jan 2012 08:37:11 +0100 Subject: Log Service improved --- runtime/org.eclipse.etrice.modellib/models/ALogService.room | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'runtime') diff --git a/runtime/org.eclipse.etrice.modellib/models/ALogService.room b/runtime/org.eclipse.etrice.modellib/models/ALogService.room index 3a946c1ce..d6f91e3c9 100644 --- a/runtime/org.eclipse.etrice.modellib/models/ALogService.room +++ b/runtime/org.eclipse.etrice.modellib/models/ALogService.room @@ -72,6 +72,12 @@ RoomModel room.basic.service.logging { } ProtocolClass Log { + usercode2 { + "public static final int LOG_LEVEL_LOW = 1;" + "public static final int LOG_LEVEL_MEDIUM = 2;" + "public static final int LOG_LEVEL_HIGH = 3;" + } + incoming { Message open(fileName: string) Message close() @@ -80,9 +86,6 @@ RoomModel room.basic.service.logging { conjugate PortClass { usercode { - "public static final int LOG_LEVEL_LOW = 1;" - "public static final int LOG_LEVEL_MEDIUM = 2;" - "public static final int LOG_LEVEL_HIGH = 3;" "static int logLevel=0;" "InternalLogData d = new InternalLogData();" } -- cgit v1.2.3