Package org.soybeanMilk.web.vp

Examples of org.soybeanMilk.web.vp.VariablePath


  public void getMatched()
  {
    //-----------------------
    // null
    {
      VariablePath matched=matcher.getMatched((String)null);
      Assert.assertNull(matched);
    }
    {
      VariablePath matched=matcher.getMatched((VariablePath)null);
      Assert.assertNull(matched);
    }
    {
      VariablePath matched=matcher.getMatched("/abc/def");
      Assert.assertNull(matched);
    }
    {
      VariablePath matched=matcher.getMatched("/abc/{def}");
      Assert.assertNull(matched);
    }
    {
      VariablePath matched=matcher.getMatched("/abc/def/ghi/sdf");
      Assert.assertNull(matched);
    }
   
    //-----------------------
    // "/abc"
    {
      VariablePath matched=matcher.getMatched("/abc");
      Assert.assertEquals("/abc",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/{abc}");
      Assert.assertNull(matched);
    }
   
    //-----------------------
    // "/{abc}/{def}/ghi"
    {
      VariablePath matched=matcher.getMatched("/{abc}/{def}/ghi");
      Assert.assertEquals("/{abc}/{def}/ghi",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/{3333}/{5555}/ghi");
      Assert.assertEquals("/{abc}/{def}/ghi",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/view/001/ghi");
      Assert.assertEquals("/{abc}/{def}/ghi",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/edit/001/ghi");
      Assert.assertEquals("/{abc}/{def}/ghi",matched.toString());
    }
   
    //-----------------------
    // "/{abc}/def/{ghi}"
    {
      VariablePath matched=matcher.getMatched("/{abc}/def/{ghi}");
      Assert.assertEquals("/{abc}/def/{ghi}",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/{ab342bc}/def/{gbsdhi}");
      Assert.assertEquals("/{abc}/def/{ghi}",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/query/def/0035");
      Assert.assertEquals("/{abc}/def/{ghi}",matched.toString());
    }
   
    //-----------------------
    // "/{abc}/def/ghi"
    {
      VariablePath matched=matcher.getMatched("/{abc}/def/ghi");
      Assert.assertEquals("/{abc}/def/ghi",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/{abdfewc}/def/ghi");
      Assert.assertEquals("/{abc}/def/ghi",matched.toString());
    }
    {
      VariablePath matched=matcher.getMatched("/hahaha003/def/ghi");
      Assert.assertEquals("/{abc}/def/ghi",matched.toString());
    }
   
    //-----------------------
    // "/abc/def/ghi"
    {
      VariablePath matched=matcher.getMatched("/abc/def/ghi");
      Assert.assertEquals("/abc/def/ghi",matched.toString());
    }
  }
View Full Code Here


 
  @Test
  public void create()
  {
    {
      VariablePath vp=new VariablePath("/abc/def/ghi");
      Assert.assertTrue( !vp.isVariable() );
      Assert.assertEquals(3, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("abc/{def}/ghi");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(3, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("abc/{def}/ghi/");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(3, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("{abc}");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(1, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("/{abc}");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(1, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("/abc/{def}/ghi");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(3, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("/abc/{def}/ghi/");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(3, vp.getPathNodeLength());
    }
   
    {
      VariablePath vp=new VariablePath("///abc/{def}/////ghi/");
      Assert.assertTrue( vp.isVariable() );
      Assert.assertEquals(3, vp.getPathNodeLength());
    }
  }
View Full Code Here

 
  @Test
  public void compareTo()
  {
    {
      VariablePath vp0=new VariablePath("/abc/def/ghi");
      VariablePath vp1=new VariablePath("/abc/def/ghi");
     
      Assert.assertTrue( vp0.compareTo(vp1)==0 );
    }
   
    {
      VariablePath vp0=new VariablePath("/abc/def/ghi");
      VariablePath vp1=new VariablePath("/abc/def/{ghi}");
     
      Assert.assertTrue( vp0.compareTo(vp1)>0 );
    }
   
    {
      VariablePath vp0=new VariablePath("/abc/def");
      VariablePath vp1=new VariablePath("/abc/def/{ghi}");
     
      Assert.assertTrue( vp0.compareTo(vp1)<0 );
    }
   
    {
      VariablePath vp0=new VariablePath("/abc/{def}/{ghi}");
      VariablePath vp1=new VariablePath("/abc/def/ghi");
     
      Assert.assertTrue( vp0.compareTo(vp1)<0 );
    }
   
    {
      VariablePath vp0=new VariablePath("{ghi}/abc/def");
      VariablePath vp1=new VariablePath("/abc/def/{ghi}");
     
      Assert.assertTrue( vp0.compareTo(vp1)<0 );
    }
   
    {
      VariablePath vp0=new VariablePath("/abc/{def}/ghi");
      VariablePath vp1=new VariablePath("/abc/{ghi}/ghi");
     
      Assert.assertTrue( vp0.compareTo(vp1)==0 );
    }
  }
View Full Code Here

      throws ExecuteException
  {
    Executable re=super.findExecutable(executableName, objSource);
    if(re==null && isEnableVariablePath())
    {
      VariablePath valuePath=new VariablePath(executableName);
      VariablePath targetPath=getVariablePathMatcher().getMatched(valuePath);
      if(targetPath != null)
        re=getConfiguration().getExecutable(targetPath.getVariablePath());
     
      if(re != null)
      {
        if(log.isDebugEnabled())
          log.debug("found "+SbmUtils.toString(re)+" that matches name "+SbmUtils.toString(executableName));
       
        PathNode[] pathNodes=targetPath.getPathNodes();
        for(int i=0;i<pathNodes.length;i++)
        {
          if(pathNodes[i].isVariable())
          {
            try
View Full Code Here

TOP

Related Classes of org.soybeanMilk.web.vp.VariablePath

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.