Package org.beangle.struts2.convention.config

Examples of org.beangle.struts2.convention.config.SmartActionConfigBuilderTest$MyPackageConfig


    }
    return myProfiles;
  }

  private Profile populatProfile(Properties props, String name) {
    Profile profile = new Profile();
    profile.setName(name);
    String actionPattern = props.getProperty(profile.getName() + ".actionPattern");
    if (isEmpty(actionPattern)) { return null; }
    populateAttr(profile, "actionPattern", props);
    populateAttr(profile, "actionSuffix", props);
    populateAttr(profile, "viewPath", props);
    populateAttr(profile, "viewExtension", props);
View Full Code Here


   */
  public String getViewPath(String className, String methodName, String viewName) {
    if (StringUtils.isNotEmpty(viewName)) {
      if (viewName.charAt(0) == Constants.separator) { return viewName; }
    }
    Profile profile = profileServie.getProfile(className);
    if (null == profile) { throw new RuntimeException("no convention profile for " + className); }
    StringBuilder buf = new StringBuilder();
    if (profile.getViewPathStyle().equals(Constants.FULL_VIEWPATH)) {
      buf.append(Constants.separator);
      buf.append(profile.getSimpleName(className));
    } else if (profile.getViewPathStyle().equals(Constants.SIMPLE_VIEWPATH)) {
      buf.append(profile.getViewPath());
      // 添加中缀路径
      buf.append(profile.getInfix(className));
    } else if (profile.getViewPathStyle().equals(Constants.SEO_VIEWPATH)) {
      buf.append(profile.getViewPath());
      buf.append(StrUtils.unCamel(profile.getInfix(className)));
    } else {
      throw new RuntimeException(profile.getViewPathStyle() + " was not supported");
    }
    // add method mapping path
    buf.append(Constants.separator);
    if (StringUtils.isEmpty(viewName) || viewName.equals("success")) {
      viewName = methodName;
View Full Code Here

   *
   * @param clazz
   * @return
   */
  public Action build(String className) {
    Profile profile = profileService.getProfile(className);
    Action action = new Action();
    StringBuilder sb = new StringBuilder();
    // namespace
    sb.append(profile.getUriPath());
    if (Constants.SHORT_URI.equals(profile.getUriPathStyle())) {
      String simpleName = className.substring(className.lastIndexOf('.') + 1);
      sb.append(StringUtils.uncapitalize(simpleName.substring(0, simpleName.length()
          - profile.getActionSuffix().length())));
    } else if (Constants.SIMPLE_URI.equals(profile.getUriPathStyle())) {
      sb.append(profile.getInfix(className));
    } else if (Constants.SEO_URI.equals(profile.getUriPathStyle())) {
      sb.append(StrUtils.unCamel(profile.getInfix(className)));
    } else {
      throw new RuntimeException("unsupported uri style " + profile.getUriPathStyle());
    }
    action.path(sb.toString()).method(profile.getDefaultMethod()).extention(profile.getUriExtension());
    return action;
  }
View Full Code Here

@Test
public class SmartActionConfigBuilderTest {

  public void test21() {
    ActionBuilder actionNameBuilder = new DefaultActionBuilder();
    ProfileService profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);

    ObjectFactory of = new ObjectFactory();
    final DummyContainer mockContainer = new DummyContainer();
    Configuration configuration = new DefaultConfiguration() {
View Full Code Here

  ActionBuilder actionNameBuilder;
  ProfileService profileService;

  @BeforeClass
  public void init() {
    actionNameBuilder = new DefaultActionBuilder();
    profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);
  }
View Full Code Here

@Test
public class SmartActionConfigBuilderTest {

  public void test21() {
    ActionBuilder actionNameBuilder = new DefaultActionBuilder();
    ProfileService profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);

    ObjectFactory of = new ObjectFactory();
    final DummyContainer mockContainer = new DummyContainer();
    Configuration configuration = new DefaultConfiguration() {
      @Override
View Full Code Here

  ProfileService profileService;

  @BeforeClass
  public void init() {
    actionNameBuilder = new DefaultActionBuilder();
    profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);
  }
View Full Code Here

@Test
public class SmartActionConfigBuilderTest {

  public void test21() {
    ActionBuilder actionNameBuilder = new DefaultActionBuilder();
    ProfileService profileService = new ProfileServiceImpl();
    actionNameBuilder.setProfileService(profileService);

    ObjectFactory of = new ObjectFactory();
    final DummyContainer mockContainer = new DummyContainer();
    Configuration configuration = new DefaultConfiguration() {
View Full Code Here

    library.authorityManager = authorityManager;
    return library;
  }

  public TagModel getGuard() {
    TagModel model = models.get(Guard.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new Guard(stack, authorityManager);
        }
      };
      models.put(Guard.class, model);
View Full Code Here

    }
    return model;
  }

  public TagModel getAvatar() {
    TagModel model = models.get(AvatarImage.class);
    if (null == model) {
      model = new TagModel(stack) {
        protected Component getBean() {
          return new AvatarImage(stack, authorityManager);
        }
      };
      models.put(AvatarImage.class, model);
View Full Code Here

TOP

Related Classes of org.beangle.struts2.convention.config.SmartActionConfigBuilderTest$MyPackageConfig

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.