private static String getResourcePath(String rawPath)
  {
    if (rawPath.charAt(0) == '/')
    {
      return rawPath.substring(1);
    }
    return rawPath;
  }
@Test
  public void testActionResource() throws Exception
  {
    String idl = moduleDir + FS + IDLS_DIR + FS + "testAction.restspec.json";
    Set<BuilderSpec> builderSpecs = generateBuilderSpec(new String[] {idl});
    Assert.assertNotNull(builderSpecs);
    Assert.assertEquals(builderSpecs.size(), 27);

    ActionSetRootBuilderSpec rootBuilder = null;
    List<ActionBuilderSpec> actionBuilders = new ArrayList<>();

    for (BuilderSpec spec : builderSpecs)
    {
      if (spec instanceof RootBuilderSpec)
      {
        Assert.assertTrue(spec instanceof ActionSetRootBuilderSpec);
        rootBuilder = (ActionSetRootBuilderSpec) spec;
      }
      else if (spec instanceof ActionBuilderSpec)
      {
        actionBuilders.add((ActionBuilderSpec) spec);
      }
      else
      {
        Assert.fail("There should not be any other builder spec generated!");
      }
    }
    Assert.assertNotNull(rootBuilder);
    Assert.assertEquals(rootBuilder.getSourceIdlName(), idl);
    Assert.assertEquals(rootBuilder.getResourcePath(), "testAction");

    Assert.assertNotNull(rootBuilder.getResourceActions());
    Assert.assertEquals(rootBuilder.getResourceActions().size(), 26);

    for (RootBuilderMethodSpec methodSpec : rootBuilder.getMethods())
    {
      Assert.assertTrue(methodSpec.getReturn() instanceof ActionBuilderSpec);
      Assert.assertEquals(methodSpec.getReturn().getRootBuilderMethod(), methodSpec);
    }

    Assert.assertNotNull(actionBuilders);
    Assert.assertEquals(actionBuilders.size(), 26);
    Set<String> actionNames = new HashSet<>(Arrays.asList("arrayPromise", "echo", "echoRecord", "echoRecordArray", "echoStringArray",
        "echoEnumArray", "failCallbackCall", "failCallbackThrow", "failPromiseCall", "failPromiseThrow",
        "failTaskCall", "failTaskThrow", "failThrowInTask", "get", "nullPromise",
        "nullTask", "parseq", "parseq3", "returnBool", "returnBoolOptionalParam",
        "returnInt", "returnIntOptionalParam", "returnVoid", "timeout", "timeoutCallback",
        "ultimateAnswer"));
    for (ActionBuilderSpec spec : actionBuilders)
    {
      Assert.assertTrue(actionNames.contains(spec.getActionName()));
      actionNames.remove(spec.getActionName());
      if (spec.getActionName().equals("parseq"))
      {
        List<ActionParamBindingMethodSpec> params = spec.getActionParamMethods();
        for (ActionParamBindingMethodSpec param : params)
        {
          if (param.getParamName().equals("a"))
          {
            Assert.assertEquals(param.getArgType().getSchema().getType(), DataSchema.Type.INT);
          }
          else if (param.getParamName().equals("b"))
          {
            Assert.assertEquals(param.getArgType().getSchema().getType(), DataSchema.Type.STRING);
          }
          else if (param.getParamName().equals("c"))
          {
            Assert.assertEquals(param.getArgType().getSchema().getType(), DataSchema.Type.BOOLEAN);
          }
          else
          {
            Assert.fail("There should not be any other param method spec generated!");
          }
        }
        Assert.assertEquals(spec.getValueClass().getSchema().getType(), DataSchema.Type.STRING);
      }
    }

    Assert.assertTrue(actionNames.isEmpty());
  }