Java Code Examples for org.apache.kylin.metadata.project.ProjectManager#listAllRealizations()
The following examples show how to use
org.apache.kylin.metadata.project.ProjectManager#listAllRealizations() .
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: CubeManager.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@Override public void onProjectSchemaChange(Broadcaster broadcaster, String project) throws IOException { ProjectManager projectManager = ProjectManager.getInstance(config); for (IRealization real : projectManager.listAllRealizations(project)) { if (real instanceof CubeInstance) { reloadCubeQuietly(real.getName()); } } projectManager.reloadProjectL2Cache(project); }
Example 2
Source File: CubeManager.java From kylin with Apache License 2.0 | 5 votes |
@Override public void onProjectSchemaChange(Broadcaster broadcaster, String project) throws IOException { ProjectManager projectManager = ProjectManager.getInstance(config); for (IRealization real : projectManager.listAllRealizations(project)) { if (real instanceof CubeInstance) { reloadCubeQuietly(real.getName()); } } projectManager.reloadProjectL2Cache(project); }
Example 3
Source File: ProjectManagerTest.java From kylin-on-parquet-v2 with Apache License 2.0 | 4 votes |
@Test public void testNewProject() throws Exception { ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig()); CubeManager cubeMgr = CubeManager.getInstance(getTestConfig()); CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getTestConfig()); int originalProjectCount = prjMgr.listAllProjects().size(); int originalCubeCount = cubeMgr.listAllCubes().size(); int originalCubeCountInDefault = prjMgr.listAllRealizations("default").size(); ResourceStore store = getStore(); // clean legacy in case last run failed store.deleteResource("/cube/cube_in_alien_project.json"); CubeDesc desc = cubeDescMgr.getCubeDesc("test_kylin_cube_with_slr_desc"); CubeInstance createdCube = cubeMgr.createCube("cube_in_alien_project", "alien", desc, null); assertTrue(createdCube.equals(cubeMgr.getCube("cube_in_alien_project"))); ProjectManager proMgr = ProjectManager.getInstance(getTestConfig()); Set<IRealization> realizations = proMgr.listAllRealizations("alien"); assertTrue(realizations.contains(createdCube)); //System.out.println(JsonUtil.writeValueAsIndentString(createdCube)); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount + 1); assertTrue(prjMgr.listAllRealizations("ALIEN").iterator().next().getName().equalsIgnoreCase("CUBE_IN_ALIEN_PROJECT")); assertTrue(cubeMgr.listAllCubes().size() == originalCubeCount + 1); prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "default", null); assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 0); assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault + 1); assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("default").contains(createdCube)); prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "alien", null); assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 1); assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault); assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("alien").contains(createdCube)); CubeInstance droppedCube = cubeMgr.dropCube("cube_in_alien_project", true); assertTrue(createdCube.equals(droppedCube)); assertNull(cubeMgr.getCube("cube_in_alien_project")); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount + 1); assertTrue(cubeMgr.listAllCubes().size() == originalCubeCount); prjMgr.dropProject("alien"); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount); }
Example 4
Source File: ProjectManagerTest.java From kylin with Apache License 2.0 | 4 votes |
@Test public void testNewProject() throws Exception { ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig()); CubeManager cubeMgr = CubeManager.getInstance(getTestConfig()); CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getTestConfig()); int originalProjectCount = prjMgr.listAllProjects().size(); int originalCubeCount = cubeMgr.listAllCubes().size(); int originalCubeCountInDefault = prjMgr.listAllRealizations("default").size(); ResourceStore store = getStore(); // clean legacy in case last run failed store.deleteResource("/cube/cube_in_alien_project.json"); CubeDesc desc = cubeDescMgr.getCubeDesc("test_kylin_cube_with_slr_desc"); CubeInstance createdCube = cubeMgr.createCube("cube_in_alien_project", "alien", desc, null); assertTrue(createdCube.equals(cubeMgr.getCube("cube_in_alien_project"))); ProjectManager proMgr = ProjectManager.getInstance(getTestConfig()); Set<IRealization> realizations = proMgr.listAllRealizations("alien"); assertTrue(realizations.contains(createdCube)); //System.out.println(JsonUtil.writeValueAsIndentString(createdCube)); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount + 1); assertTrue(prjMgr.listAllRealizations("ALIEN").iterator().next().getName().equalsIgnoreCase("CUBE_IN_ALIEN_PROJECT")); assertTrue(cubeMgr.listAllCubes().size() == originalCubeCount + 1); prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "default", null); assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 0); assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault + 1); assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("default").contains(createdCube)); prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "alien", null); assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 1); assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault); assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("alien").contains(createdCube)); CubeInstance droppedCube = cubeMgr.dropCube("cube_in_alien_project", true); assertTrue(createdCube.equals(droppedCube)); assertNull(cubeMgr.getCube("cube_in_alien_project")); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount + 1); assertTrue(cubeMgr.listAllCubes().size() == originalCubeCount); prjMgr.dropProject("alien"); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount); }
Example 5
Source File: ProjectManagerTest.java From Kylin with Apache License 2.0 | 4 votes |
@Test public void testNewProject() throws Exception { ProjectManager prjMgr = ProjectManager.getInstance(getTestConfig()); CubeManager cubeMgr = CubeManager.getInstance(getTestConfig()); CubeDescManager cubeDescMgr = CubeDescManager.getInstance(getTestConfig()); int originalProjectCount = prjMgr.listAllProjects().size(); int originalCubeCount = cubeMgr.listAllCubes().size(); int originalCubeCountInDefault = prjMgr.listAllRealizations("default").size(); ResourceStore store = getStore(); // clean legacy in case last run failed store.deleteResource("/cube/cube_in_alien_project.json"); CubeDesc desc = cubeDescMgr.getCubeDesc("test_kylin_cube_with_slr_desc"); CubeInstance createdCube = cubeMgr.createCube("cube_in_alien_project", "alien", desc, null); assertTrue(createdCube == cubeMgr.getCube("cube_in_alien_project")); ProjectManager proMgr = ProjectManager.getInstance(getTestConfig()); Set<IRealization> realizations = proMgr.listAllRealizations("alien"); assertTrue(realizations.contains(createdCube)); System.out.println(JsonUtil.writeValueAsIndentString(createdCube)); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount + 1); assertTrue(prjMgr.listAllRealizations("ALIEN").iterator().next().getName().equalsIgnoreCase("CUBE_IN_ALIEN_PROJECT")); assertTrue(cubeMgr.listAllCubes().size() == originalCubeCount + 1); prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "default", null); assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 0); assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault + 1); assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("default").contains(createdCube)); prjMgr.moveRealizationToProject(RealizationType.CUBE, "cube_in_alien_project", "alien", null); assertTrue(prjMgr.listAllRealizations("ALIEN").size() == 1); assertTrue(prjMgr.listAllRealizations("default").size() == originalCubeCountInDefault); assertTrue(ProjectManager.getInstance(getTestConfig()).listAllRealizations("alien").contains(createdCube)); CubeInstance droppedCube = cubeMgr.dropCube("cube_in_alien_project", true); assertTrue(createdCube == droppedCube); assertNull(cubeMgr.getCube("cube_in_alien_project")); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount + 1); assertTrue(cubeMgr.listAllCubes().size() == originalCubeCount); prjMgr.dropProject("alien"); assertTrue(prjMgr.listAllProjects().size() == originalProjectCount); }