Commit 84dd020d authored by stancakapost's avatar stancakapost
Browse files

added adaptation plugins for TTworkbench

parent 61ae297a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="con" path="com.testingtech.ttworkbench.core.TTWB_LIBRARY"/>
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
	<classpathentry kind="src" output="build/RawAndXMLCodec" path="RawAndXMLCodec"/>
	<classpathentry kind="src" output="build/XmlDiffExternalFunction" path="XmlDiffExternalFunction"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="var" path="ECLIPSE_HOME/plugins/com.testingtech.ttworkbench.xsd.rt_1.1.9.201404111943I/tt3plugins/xsdRuntimePlugin/lib/xsdRuntimePlugin.jar"/>
	<classpathentry kind="lib" path="tt3plugins/XmlDiffExternalFunction/xmldiff.jar"/>
	<classpathentry kind="lib" path="tt3plugins/XmlDiffExternalFunction/xmlunit-1.5.jar"/>
	<classpathentry kind="output" path="build/default"/>
</classpath>
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>TTworkbenchAdapter</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>com.testingtech.ttworkbench.ttthree.modelBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>org.eclipse.jdt.core.javabuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
		<buildCommand>
			<name>com.testingtech.ttworkbench.xcleditor.todoBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>com.testingtech.ttworkbench.core.ttcn3nature</nature>
		<nature>org.eclipse.jdt.core.javanature</nature>
	</natures>
</projectDescription>
+19 −0
Original line number Diff line number Diff line
clf.output_folder=//PROJECT_NAME//clf
clf.output_same_as_binary=false
eclipse.preferences.version=1
environment.append=true
environment.variables=
tt3-plugins-path=//PROJECT_NAME//tt3plugins
ttcn3.continue_on_fail=false
ttcn3.gen_debug_code_record_init=false
ttcn3.generate_mlf=false
ttcn3.main_module=
ttcn3.mlf_class=
ttcn3.mlf_jar=
ttcn3.output_folder=//PROJECT_NAME//ttcn3build
ttcn3.output_same_as_src=false
ttcn3.save_log_automatically=false
ttcn3.source_folders=//PROJECT_NAME//ttcn3\n//PROJECT_NAME//ttcn3/Pos_060301_integer_001\n//PROJECT_NAME//ttcn3/Pos_060108_maxinclusive_001
ttcn3.tlz.output_folder=
ttcn3.use_bigint=false
ttcn3.use_destination_path_for_ttcn3view=false
+24 −0
Original line number Diff line number Diff line
eclipse.preferences.version=1
gen-xsd-codec=true
xsd-convert-sets-into-records=true
xsd-convert-unions-into-records-of-optionals=false
xsd-generate-all-fields-optional=false
xsd-generate-enumerations=true
xsd-implicitly-import-xsdaux=true
xsd-interleave-text-and-elements=false
xsd-mangle-attribute-names=false
xsd-mangle-element-names=false
xsd-mangle-names-standard-conform=true
xsd-map-any-to-anytype=false
xsd-map-optional-union-fields-to-record-of=true
xsd-map-substitution-groups-with-unions=false
xsd-map-subtyping-with-unions=false
xsd-merge-attributes-into-parent=true
xsd-merge-elements-into-parent=true
xsd-merge-namespaces-into-one-module=false
xsd-output-path=tt3plugins_generated
xsd-package-name=
xsd-profile=standard
xsd-replace-bad-chars-with-underscore=true
xsd-strip-namespaces=false
xsd-use-anyattribute-aux-type=false
+53 −0
Original line number Diff line number Diff line
package com.testingtech.tci.codec;

import java.nio.charset.Charset;

import org.etsi.ttcn.tci.TciCDProvided;
import org.etsi.ttcn.tci.TciTypeClass;
import org.etsi.ttcn.tci.Type;
import org.etsi.ttcn.tci.Value;
import org.etsi.ttcn.tri.TriMessage;

import com.testingtech.ttcn.extension.CodecProvider;
import com.testingtech.ttcn.tri.AbstractCodecPlugin;
import com.testingtech.xmlschema.codec.runtime.XMLCodecPlugin;

import de.tu_berlin.cs.uebb.muttcn.runtime.RB;
import de.tu_berlin.cs.uebb.ttcn.runtime.BaseCharString;

public class RawAndXMLCodecPlugin extends AbstractCodecPlugin implements CodecProvider {

  private XMLCodecPlugin xmlCodec;

  @Override
  public boolean setUp() {
    boolean setUpResult = super.setUp();
    xmlCodec = new XMLCodecPlugin();
    xmlCodec.initAbstractPlugin(getRB());
    setUpResult |= xmlCodec.setUp();
    return setUpResult;
  }
  
  @Override
  public Value decode(TriMessage message, Type decodingHypothesis) {
    if ("Raw".equals(decodingHypothesis.getName())) {
      if (decodingHypothesis.getTypeClass() == TciTypeClass.CHARSTRING ||
          decodingHypothesis.getTypeClass() == TciTypeClass.UNIVERSAL_CHARSTRING) {
        BaseCharString string = (BaseCharString) decodingHypothesis.newInstance();
        string.setString(new String(message.getEncodedMessage(), Charset.forName("UTF-8")));
        return string;
      }
    }
    return xmlCodec.decode(message, decodingHypothesis);
  }

  @Override
  public TriMessage encode(Value value) {
    return xmlCodec.encode(value);
  }

  public TciCDProvided getCodec(RB RB, String encodingRule) {
    return new RawAndXMLCodecPlugin();
  }

}
Loading