package com.continuuity.gateway.router;

import com.continuuity.common.conf.Constants;
import junit.framework.Assert;
import org.junit.Test;

/**
 *  To test the RouterPathLookup regular expression tests.
 */
public class RouterPathTest {

  @Test
  public void testRouterFlowPathLookUp() throws Exception {
    String flowPath = "/v2//apps/ResponseCodeAnalytics/flows/LogAnalyticsFlow/status";
    String result = RouterPathLookup.getRoutingPath(flowPath, "GET");
    Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP, result);
  }

  @Test
  public void testRouterWorkFlowPathLookUp() throws Exception {
    String procPath = "/v2/apps/PurchaseHistory/workflows/PurchaseHistoryWorkflow/status";
    String result = RouterPathLookup.getRoutingPath(procPath, "GET");
    Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP,  result);
  }

  @Test
  public void testRouterProcedurePathLookUp() throws Exception {
    String procPath = "/v2//apps/ResponseCodeAnalytics/procedures/StatusCodeProcedure/status";
    String result = RouterPathLookup.getRoutingPath(procPath, "GET");
    Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP,  result);
  }

  @Test
  public void testRouterDeployPathLookUp() throws Exception {
    String procPath = "/v2//apps/";
    String result = RouterPathLookup.getRoutingPath(procPath, "PUT");
    Assert.assertEquals(Constants.Service.APP_FABRIC_HTTP,  result);
  }

}

@@ -111,16 +111,41 @@
 Assert;%0A
+import org.junit.Before;%0A
 import o
@@ -258,16 +258,90 @@
 Test %7B%0A%0A
+  @Before%0A  public void beforeTests() %7B%0A    RouterPathLookup.init();%0A  %7D%0A%0A
   @Test%0A

Fix broken router path tests