Java Code Examples for org.apache.kylin.metadata.project.ProjectInstance#setName()
The following examples show how to use
org.apache.kylin.metadata.project.ProjectInstance#setName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProjectControllerTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 6 votes |
@Test public void testAddUpdateProject() throws IOException { int originalProjectCount = projectController.getProjects(null, null).size(); //test add project ProjectInstance project = new ProjectInstance(); project.setName("new_project"); ProjectInstance ret = projectController.saveProject(getProjectRequest(project, null)); Assert.assertEquals(ret.getOwner(), "ADMIN"); Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1); //test update project description only ProjectInstance newProject2 = new ProjectInstance(); newProject2.setName("new_project"); newProject2.setDescription("hello world"); projectController.updateProject(getProjectRequest(newProject2, "new_project")); Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1); Assert.assertNotEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project"), null); Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project").getDescription(), "hello world"); }
Example 2
Source File: ProjectControllerTest.java From kylin with Apache License 2.0 | 6 votes |
@Test public void testAddUpdateProject() throws IOException { int originalProjectCount = projectController.getProjects(null, null).size(); //test add project ProjectInstance project = new ProjectInstance(); project.setName("new_project"); ProjectInstance ret = projectController.saveProject(getProjectRequest(project, null)); Assert.assertEquals(ret.getOwner(), "ADMIN"); Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1); //test update project description only ProjectInstance newProject2 = new ProjectInstance(); newProject2.setName("new_project"); newProject2.setDescription("hello world"); projectController.updateProject(getProjectRequest(newProject2, "new_project")); Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).listAllProjects().size(), originalProjectCount + 1); Assert.assertNotEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project"), null); Assert.assertEquals(ProjectManager.getInstance(getTestConfig()).getProject("new_project").getDescription(), "hello world"); }
Example 3
Source File: ProjectControllerTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Test(expected = InternalErrorException.class) public void testAddExistingProject() throws IOException { ProjectInstance newProject = new ProjectInstance(); newProject.setName("default"); projectController.saveProject(getProjectRequest(newProject, null)); }
Example 4
Source File: ProjectControllerTest.java From kylin with Apache License 2.0 | 5 votes |
@Test(expected = InternalErrorException.class) public void testAddExistingProject() throws IOException { ProjectInstance newProject = new ProjectInstance(); newProject.setName("default"); projectController.saveProject(getProjectRequest(newProject, null)); }
Example 5
Source File: ProjectCreator.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
public static ProjectInstance generateKylinProjectInstance(String owner, List<TableDesc> kylinTables, List<DataModelDesc> kylinModels, List<CubeDesc> kylinCubeDescs) { ProjectInstance projectInstance = new ProjectInstance(); projectInstance.setName(MetricsManager.SYSTEM_PROJECT); projectInstance.setOwner(owner); projectInstance.setDescription(SYSTEM_PROJECT_DESC); projectInstance.setStatus(ProjectStatusEnum.ENABLED); projectInstance.setCreateTimeUTC(0L); projectInstance.updateRandomUuid(); if (kylinTables != null) projectInstance.setTables(Sets.newHashSet(Lists.transform(kylinTables, new Function<TableDesc, String>() { @Nullable @Override public String apply(@Nullable TableDesc tableDesc) { if (tableDesc != null) { return tableDesc.getIdentity(); } return null; } }))); else projectInstance.setTables(Sets.<String> newHashSet()); if (kylinModels != null) projectInstance.setModels(Lists.transform(kylinModels, new Function<DataModelDesc, String>() { @Nullable @Override public String apply(@Nullable DataModelDesc modelDesc) { if (modelDesc != null) { return modelDesc.getName(); } return null; } })); else projectInstance.setModels(Lists.<String> newArrayList()); if (kylinCubeDescs != null) projectInstance .setRealizationEntries(Lists.transform(kylinCubeDescs, new Function<CubeDesc, RealizationEntry>() { @Nullable @Override public RealizationEntry apply(@Nullable CubeDesc cubeDesc) { if (cubeDesc != null) { RealizationEntry entry = new RealizationEntry(); entry.setRealization(cubeDesc.getName()); entry.setType(RealizationType.CUBE); return entry; } return null; } })); else projectInstance.setRealizationEntries(Lists.<RealizationEntry> newArrayList()); return projectInstance; }
Example 6
Source File: ProjectCreator.java From kylin with Apache License 2.0 | 4 votes |
public static ProjectInstance generateKylinProjectInstance(String owner, List<TableDesc> kylinTables, List<DataModelDesc> kylinModels, List<CubeDesc> kylinCubeDescs) { ProjectInstance projectInstance = new ProjectInstance(); projectInstance.setName(MetricsManager.SYSTEM_PROJECT); projectInstance.setOwner(owner); projectInstance.setDescription(SYSTEM_PROJECT_DESC); projectInstance.setStatus(ProjectStatusEnum.ENABLED); projectInstance.setCreateTimeUTC(0L); projectInstance.updateRandomUuid(); if (kylinTables != null) projectInstance.setTables(Sets.newHashSet(Lists.transform(kylinTables, new Function<TableDesc, String>() { @Nullable @Override public String apply(@Nullable TableDesc tableDesc) { if (tableDesc != null) { return tableDesc.getIdentity(); } return null; } }))); else projectInstance.setTables(Sets.<String> newHashSet()); if (kylinModels != null) projectInstance.setModels(Lists.transform(kylinModels, new Function<DataModelDesc, String>() { @Nullable @Override public String apply(@Nullable DataModelDesc modelDesc) { if (modelDesc != null) { return modelDesc.getName(); } return null; } })); else projectInstance.setModels(Lists.<String> newArrayList()); if (kylinCubeDescs != null) projectInstance .setRealizationEntries(Lists.transform(kylinCubeDescs, new Function<CubeDesc, RealizationEntry>() { @Nullable @Override public RealizationEntry apply(@Nullable CubeDesc cubeDesc) { if (cubeDesc != null) { RealizationEntry entry = new RealizationEntry(); entry.setRealization(cubeDesc.getName()); entry.setType(RealizationType.CUBE); return entry; } return null; } })); else projectInstance.setRealizationEntries(Lists.<RealizationEntry> newArrayList()); return projectInstance; }