Package statechum.analysis.Erlang

Examples of statechum.analysis.Erlang.ErlangModule


  public void testLearningFromErlangTraceFile2() throws IOException
  {
    ErlangModule.setupErlangConfiguration(config,new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
        config.setErlangCompileIntoBeamDirectory(true);
    ErlangModule mod = ErlangModule.loadModule(config);
    Set<ErlangLabel> alphabetA = new TreeSet<ErlangLabel>();alphabetA.addAll(mod.behaviour.getAlphabet());
    ErlangModule.flushRegistry();

    ErlangModule.setupErlangConfiguration(config,new File(lockerFile));
    config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);config.setErlangCompileIntoBeamDirectory(true);
    ErlangModule modSame = ErlangModule.loadModule(config);
    Assert.assertTrue(alphabetA.equals(modSame.behaviour.getAlphabet()));// check that the same alphabet will be loaded second time.
    ErlangModule.flushRegistry();
   
    createLogFileFromExistingLog("earlier_failure2.txt");
    ErlangOracleLearner learner = ErlangQSMOracle.createLearner(null,modifiedLogFile);
View Full Code Here


    learnerConfig.config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);learnerConfig.config.setTransitionMatrixImplType(STATETREE.STATETREE_SLOWTREE);
    learnerConfig.config.setErlWaitForWrapperDelay(wrapperDelay);
    learnerConfig.config.setErlangInitialTraceLength(3);
    learnerConfig.config.setErlangStripModuleNamesFromFunctionsInNonGenModules(true);
   
    ErlangModule mod = ErlangModule.loadModule(learnerConfig.config);
    OtpErlangTuple startFunType=mod.sigTypes.get("frequencyBroken:start/0");
    Map<String,OtpErlangTuple> override = new TreeMap<String,OtpErlangTuple>();
    override.put("frequencyBroken:start/0", new OtpErlangTuple(new OtpErlangObject[]{startFunType.elementAt(0),startFunType.elementAt(1),startFunType.elementAt(2),startFunType.elementAt(3),
        ErlangLabel.parseText("{'Func',[],[],{'Any',[]}}")}));
    mod.rebuildSigs(learnerConfig.config, override);
    mod.behaviour.generateAlphabet(config);
    ErlangOracleLearner learner = new ErlangOracleLearner(null,learnerConfig);
    LearnerGraph frequencyE = new LearnerGraph(learnerConfig.config);
    learner.init(learner.GenerateInitialTraces(learnerConfig.config.getErlangInitialTraceLength()),0,0);
   
View Full Code Here

  @Test
  public void testLearningFromErlangTraceFile2() throws IOException
  {
    Configuration config = ErlangModule.setupErlangConfiguration(new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
    ErlangModule mod = ErlangModule.loadModule(config);
    Set<ErlangLabel> alphabetA = new TreeSet<ErlangLabel>();alphabetA.addAll(mod.behaviour.getAlphabet());
    ErlangModule.flushRegistry();
    config = ErlangModule.setupErlangConfiguration(new File(lockerFile));
        config.setErlangAlphabetAnyElements(EXPANSIONOFANY.ANY_WIBBLE);
    ErlangModule modSame = ErlangModule.loadModule(config);
    Assert.assertTrue(alphabetA.equals(modSame.behaviour.getAlphabet()));// check that the same alphabet will be loaded second time.
    ErlangModule.flushRegistry();
   
    ErlangOracleLearner learner = ErlangQSMOracle.createLearner(null,"resources/earlier_failure2.txt");
    Set<ErlangLabel> alphabetFull = new TreeSet<ErlangLabel>();alphabetFull.addAll(ErlangModule.findModule("locker").behaviour.getAlphabet());
View Full Code Here

  /* The two arguments to this one are the graph to load and the .erl source of the module it corresponds to. The graphs should be saved via the "save" entry in the pop-up menu of ErlangOracleVisualiser. */
  public static void main(String[] args) throws IOException{
    File file = new File(args[1]);
    Configuration cnf = ErlangModule.setupErlangConfiguration(file);
    ErlangModule mod = ErlangModule.loadModule(cnf);

    LearnerGraphND grOrig = new LearnerGraphND(cnf);
    AbstractPersistence.loadGraph(args[0], grOrig,null);

    final LearnerGraph erlangGraph = new LearnerGraph(grOrig.config);
View Full Code Here

    for (File f : folder.listFiles()) {
      if (f.getName().endsWith(".erl")) {
        // load the module
        try {
          System.out.println("Loading " + f.getName());
          ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(f));
          DirectedSparseVertex myVertex = getVertex(mod.name);
          myVertex.setUserDatum(JUConstants.COLOUR, JUConstants.RED, UserData.SHARED);

          for (String d : mod.behaviour.getDependencies()) {
            DirectedSparseVertex v = getVertex(d);
View Full Code Here

       * ErlangRunner.getRunner());
       */
      for (Object s : app.modules) {
        try {
          // Load the module
          ErlangModule m = (ErlangModule) s;

          int len = Integer.parseInt(lenField.getText());
          boolean exhaustAlphabet = exhaustAlphabetBox.isSelected();
          boolean useOutputMatching = outputMatchingBox.isSelected();
          EXPANSIONOFANY expansion = ((InnerAlphabetModel)anyAlphabet.getModel()).getSelectedExpansion();
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(F,_,_) when F == [] -> {reply,wr(F),5}.\n");
    wr.write("wr([]) -> 1.");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    mod.sigs.put("strA", new FuncSignature(defaultConfig, ErlangLabel.parseText(
      "{\"testFile.erl\",3,handle_call,1,{'Func',[],[{'String',[],[[],\"strA\"]}],{'Int',[values],[1]}}}"),
      null));
    mod.sigs.put("strB", new FuncSignature(defaultConfig, ErlangLabel.parseText(
      "{\"testFile.erl\",3,handle_call,1,{'Func',[],[{'String',[],[\"strB\"]}],{'Int',[values],[1]}}}"),
View Full Code Here

    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(F,_,_) when F == [] -> {reply,wr(F),5}.\n");
    wr.write("wr([]) -> 1.");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    mod.sigs.put("strNonEmpty", new FuncSignature(defaultConfig, ErlangLabel.parseText(
      "{\"testFile.erl\",3,handle_call,1,{'Func',[],[{'String',[],[[]]}],{'Int',[values],[1]}}}"),
      null));
    mod.sigs.put("strNonEmpty", new FuncSignature(defaultConfig, ErlangLabel.parseText(
      "{\"testFile.erl\",3,handle_call,1,{'Func',[],[{'String',[],[[]]}],{'Int',[values],[1]}}}"),
View Full Code Here

  {
    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(4.8,_,_) -> {reply,1,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    createLabel("call, 4.8,1",config);
    createLabel("call, 4.7,1",config);
    checkFailureFor("call, 4,1",config);
    checkFailureFor("call, 4.8,2",config);
    checkFailureFor("call, 4.8,1.1",config);
View Full Code Here

  {
    Writer wr = new FileWriter(erlangFile);wr.write("-module(testFile).\n-behaviour(gen_server).\n");

    wr.write("handle_call(<< 4:2,5:6 >>,_,_) -> {reply,1,5}.\n");
    wr.write(otherMethods);wr.close();
    ErlangModule mod = ErlangModule.loadModule(ErlangModule.setupErlangConfiguration(new File(erlangFile)));
    final Configuration config = Configuration.getDefaultConfiguration().copy();config.setErlangModuleName(mod.getName());config.setLabelKind(LABELKIND.LABEL_ERLANG);
    checkFailureFor("call, 4,1",config);
  }
View Full Code Here

TOP

Related Classes of statechum.analysis.Erlang.ErlangModule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.