org.guvnor.common.services.project.model.Module.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(9.4k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.guvnor.common.services.project.model.Module.<init>()方法的一些代码示例,展示了Module.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.<init>()方法的具体详情如下:
包路径:org.guvnor.common.services.project.model.Module
类名称:Module
方法名:<init>

Module.<init>介绍

暂无

代码示例

代码示例来源:origin: kiegroup/appformer

private Module getMockModule() {
    return new Module(mock(Path.class),
             mock(Path.class),
             new POM());
  }
}

代码示例来源:origin: org.uberfire/uberfire-project-client

private Module getMockModule() {
    return new Module(mock(Path.class),
             mock(Path.class),
             new POM());
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-client

@Test
public void testOnArchiveActiveModule() throws Exception {
  final Path rootModulePath = mock(Path.class);
  final POM pom = mock(POM.class);
  when(pom.getName()).thenReturn("my module");
  final Module module = new Module(rootModulePath,
                   mock(Path.class),
                   pom);
  when(context.getActiveModule()).thenReturn(Optional.of(module));
  menu.onArchiveActiveProject();
  verify(view).archive(rootModulePath);
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

private Module createModule(final String branch,
              final String moduleName) {
  final POM pom = mock(POM.class);
  when(pom.getName()).thenReturn(moduleName);
  return new Module(createMockPath(branch,
                   moduleName),
           createMockPath(branch,
                   moduleName),
           pom);
}

代码示例来源:origin: kiegroup/appformer

@Test
  public void nameNotSetGAVNotSet() throws Exception {
    final POM pom = new POM();
    final Path rootPath = mock(Path.class);
    doReturn("myProject").when(rootPath).getFileName();

    final Module module = new Module(rootPath,
                     mock(Path.class),
                     pom);

    assertEquals("myProject",
           module.getModuleName());
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-explorer-backend

private Module createModule(final String branchName,
              final Branch branch,
              final String moduleName) {
  final POM pom = mock(POM.class);
  when(pom.getName()).thenReturn(moduleName);
  final Module module = new Module(createMockPath(branchName,
                          moduleName),
                   createMockPath(branchName,
                          moduleName),
                   pom);
  final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);
  doReturn("demo").when(organizationalUnit).getName();
  doReturn(new WorkspaceProject(organizationalUnit,
                 repository,
                 branch,
                 module
  )).when(projectService).resolveProject(space,
                      branch);
  return module;
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client

@Test
public void breadcrumbIsNotUpdatedWhenInactiveModuleIsRenamedTest() {
  final WorkspaceProjectContextChangeEvent workspaceProjectContextChangeEvent = new WorkspaceProjectContextChangeEvent(mock(WorkspaceProject.class),
                                                             new Module(mock(Path.class),
                                                                  mock(Path.class),
                                                                  new POM("moduleName",
                                                                      "description",
                                                                      "url",
                                                                      new GAV())));
  libraryPlaces.onChange(workspaceProjectContextChangeEvent,
              workspaceProjectContextChangeEvent);
  verify(libraryBreadcrumbs,
      never()).setupForAsset(any(), any());
  verify(libraryBreadcrumbs,
      never()).setupForProject(any());
}

代码示例来源:origin: kiegroup/appformer

@Test
public void nameNotSetUseArtifactId() throws Exception {
  final POM pom = new POM(new GAV("groupId",
                  "artifactId",
                  "version"));
  final Module module = new Module(mock(Path.class),
                   mock(Path.class),
                   pom);
  assertEquals("artifactId",
         module.getModuleName());
}

代码示例来源:origin: kiegroup/appformer

@Test
public void nameIsSet() throws Exception {
  final POM pom = new POM(new GAV("groupId",
                  "artifactId",
                  "version"));
  pom.setName("my project");
  final Module module = new Module(mock(Path.class),
                   mock(Path.class),
                   pom);
  assertEquals("my project",
         module.getModuleName());
}

代码示例来源:origin: org.uberfire/uberfire-project-backend

@Override
public Module resolveParentModule(final Path resource) {
  try {
    //Null resource paths cannot resolve to a Module
    if (resource == null) {
      return null;
    }
    //Check if resource is the module root
    final org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
    if (hasPom(path)) {
      final Path moduleRootPath = Paths.convert(path);
      final Path pomXMLPath = Paths.convert(path.resolve(POM_PATH));
      final POM pom = pomService.load(pomXMLPath);
      return new Module(moduleRootPath,
               pomXMLPath,
               pom);
    } else {
      return null;
    }
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: kiegroup/appformer

@Override
public Module resolveParentModule(final Path resource) {
  try {
    //Null resource paths cannot resolve to a Module
    if (resource == null) {
      return null;
    }
    //Check if resource is the module root
    final org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
    if (hasPom(path)) {
      final Path moduleRootPath = Paths.convert(path);
      final Path pomXMLPath = Paths.convert(path.resolve(POM_PATH));
      final POM pom = pomService.load(pomXMLPath);
      return new Module(moduleRootPath,
               pomXMLPath,
               pom);
    } else {
      return null;
    }
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: org.uberfire/uberfire-project-client

final Repository oldRepository = mock(Repository.class);
final Package oldPackage = new Package();
final Module oldModule = new Module();

代码示例来源:origin: kiegroup/appformer

final Repository oldRepository = mock(Repository.class);
final Package oldPackage = new Package();
final Module oldModule = new Module();

代码示例来源:origin: org.uberfire/uberfire-project-backend

@Override
public Module resolveToParentModule(final Path resource) {
  try {
    //Null resource paths cannot resolve to a Module
    if (resource == null) {
      return null;
    }
    //Check if resource is the module root
    org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
    org.uberfire.java.nio.file.Path parentPomPath = path.resolve(POM_PATH);
    if (hasPom(path)) {
      POM parent = pomService.load(Paths.convert(parentPomPath));
      final Path moduleRootPath = Paths.convert(path);
      Module module = new Module(moduleRootPath,
                    Paths.convert(parentPomPath),
                    parent,
                    parent.getModules());
      return module;
    } else {
      return null;
    }
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: org.uberfire/uberfire-project-backend

@Test
public void resolveProjectModule() throws Exception {
  final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space,
                                           new Module(path,
                                                mock(Path.class),
                                                mock(POM.class)));
  assertEquals(ou,
         workspaceProject.getOrganizationalUnit());
  assertEquals(repository,
         workspaceProject.getRepository());
  assertEquals(branch,
         workspaceProject.getBranch());
  assertEquals(module,
         workspaceProject.getMainModule());
}

代码示例来源:origin: kiegroup/appformer

@Test
public void resolveProjectModule() throws Exception {
  final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space,
                                           new Module(path,
                                                mock(Path.class),
                                                mock(POM.class)));
  assertEquals(ou,
         workspaceProject.getOrganizationalUnit());
  assertEquals(repository,
         workspaceProject.getRepository());
  assertEquals(branch,
         workspaceProject.getBranch());
  assertEquals(module,
         workspaceProject.getMainModule());
}

代码示例来源:origin: org.uberfire/uberfire-project-backend

@Override
public Module resolveModule(org.uberfire.backend.vfs.Path resource, boolean loadPOM) {
  final String uri = resource.toURI();
  if (uri.endsWith("Project1/pom.xml")) {
    return new Module(Paths.convert(project1FolderPath),
             Paths.convert(project1FilePath),
             new POM(new GAV("test",
                     "project1",
                     "1.0")));
  } else if (uri.endsWith("Project2/pom.xml")) {
    return new Module(Paths.convert(project2FolderPath),
             Paths.convert(project2FilePath),
             new POM(new GAV("test",
                     "project2",
                     "1.0")));
  } else {
    return null;
  }
}

代码示例来源:origin: kiegroup/appformer

@Override
public Module resolveToParentModule(final Path resource) {
  try {
    //Null resource paths cannot resolve to a Module
    if (resource == null) {
      return null;
    }
    //Check if resource is the module root
    org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();
    org.uberfire.java.nio.file.Path parentPomPath = path.resolve(POM_PATH);
    if (hasPom(path)) {
      POM parent = pomService.load(Paths.convert(parentPomPath));
      final Path moduleRootPath = Paths.convert(path);
      Module module = new Module(moduleRootPath,
                    Paths.convert(parentPomPath),
                    parent,
                    parent.getModules());
      return module;
    } else {
      return null;
    }
  } catch (Exception e) {
    throw ExceptionUtilities.handleException(e);
  }
}

代码示例来源:origin: kiegroup/appformer

@Override
public Module resolveModule(org.uberfire.backend.vfs.Path resource, boolean loadPOM) {
  final String uri = resource.toURI();
  if (uri.endsWith("Project1/pom.xml")) {
    return new Module(Paths.convert(project1FolderPath),
             Paths.convert(project1FilePath),
             new POM(new GAV("test",
                     "project1",
                     "1.0")));
  } else if (uri.endsWith("Project2/pom.xml")) {
    return new Module(Paths.convert(project2FolderPath),
             Paths.convert(project2FilePath),
             new POM(new GAV("test",
                     "project2",
                     "1.0")));
  } else {
    return null;
  }
}

代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-data-modeller-api

@Test
  public void createEvent() {
    DataObject currentDataObject = new DataObjectImpl();
    ObjectProperty currentField = new ObjectPropertyImpl();
    Method currentMethod = new MethodImpl();
    Module currentModule = new Module();
    String source = "testSource";
    String contextId = "testContextId";
    Path path = new PathFactory.PathImpl();

    DataModelerEvent event = new DataModelerEvent()
        .withCurrentDataObject(currentDataObject)
        .withCurrentField(currentField)
        .withCurrentMethod(currentMethod)
        .withCurrentProject(currentModule)
        .withSource(source)
        .withContextId(contextId)
        .withPath(path);

    assertEquals(currentDataObject, event.getCurrentDataObject());
    assertEquals(currentField, event.getCurrentField());
    assertEquals(currentMethod, event.getCurrentMethod());
    assertEquals(currentModule, event.getCurrentModule());
    assertEquals(source, event.getSource());
    assertEquals(contextId, event.getContextId());
    assertEquals(path, event.getPath());
  }
}

相关文章