/* Copyright (c) 2014, Effektif GmbH.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. */
package com.effektif.workflow.test.serialization;

import org.junit.BeforeClass;

import com.effektif.workflow.api.workflow.Activity;
import com.effektif.workflow.api.workflow.Workflow;
import com.effektif.workflow.impl.mapper.BpmnMapper;


/**
 * @author Tom Baeyens
 */
public class BpmnMapperTest extends AbstractMapperTest {

  static BpmnMapper bpmnMapper = new BpmnMapper();
  
  @BeforeClass
  public static void initialize() {
    initializeMappings();
    bpmnMapper = new BpmnMapper();
    bpmnMapper.setMappings(mappings);
  }
  
  @Override
  protected <T> T serialize(T o) {
    Workflow w = null;
    if (o instanceof Activity) {
      w = new Workflow()
      .activity((Activity)o);
    } else {
      w = (Workflow) o;
    }
    
    String jsonString = bpmnMapper
      .createWriter()
      .toBpmnString(w);
    
    System.out.println(jsonString);
    
    w = bpmnMapper
      .createReader()
      .toWorkflow(jsonString);
    
    if (o instanceof Activity) {
      return (T) w.getActivities().get(0);
    } else {
      return (T) w;
    }
  }
}

@@ -1347,20 +1347,19 @@
  String 
-json
+xml
 String =
@@ -1444,20 +1444,19 @@
 println(
-json
+xml
 String);
@@ -1456,24 +1456,46 @@
 tring);%0A    
+System.out.println();%0A
 %0A    w = bpm
@@ -1546,12 +1546,11 @@
 low(
-json
+xml
 Stri

Fix naming