org.apache.hadoop.yarn.server.timeline.TimelineStore Java Examples
The following examples show how to use
org.apache.hadoop.yarn.server.timeline.TimelineStore.
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: TestSystemMetricsPublisher.java From hadoop with Apache License 2.0 | 6 votes |
@BeforeClass public static void setup() throws Exception { YarnConfiguration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); conf.setBoolean(YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_ENABLED, true); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); conf.setInt( YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE, 2); timelineServer = new ApplicationHistoryServer(); timelineServer.init(conf); timelineServer.start(); store = timelineServer.getTimelineStore(); metricsPublisher = new SystemMetricsPublisher(); metricsPublisher.init(conf); metricsPublisher.start(); }
Example #2
Source File: TestTimelineWebServices.java From big-c with Apache License 2.0 | 6 votes |
@Test public void testPostEntitiesWithPrimaryFilter() throws Exception { TimelineEntities entities = new TimelineEntities(); TimelineEntity entity = new TimelineEntity(); Map<String, Set<Object>> filters = new HashMap<String, Set<Object>>(); filters.put(TimelineStore.SystemFilter.ENTITY_OWNER.toString(), new HashSet<Object>()); entity.setPrimaryFilters(filters); entity.setEntityId("test id 6"); entity.setEntityType("test type 6"); entity.setStartTime(System.currentTimeMillis()); entities.addEntity(entity); WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("timeline") .queryParam("user.name", "tester") .accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON) .post(ClientResponse.class, entities); TimelinePutResponse putResposne = response.getEntity(TimelinePutResponse.class); Assert.assertEquals(0, putResposne.getErrors().size()); }
Example #3
Source File: TestSystemMetricsPublisher.java From big-c with Apache License 2.0 | 6 votes |
@BeforeClass public static void setup() throws Exception { YarnConfiguration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); conf.setBoolean(YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_ENABLED, true); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); conf.setInt( YarnConfiguration.RM_SYSTEM_METRICS_PUBLISHER_DISPATCHER_POOL_SIZE, 2); timelineServer = new ApplicationHistoryServer(); timelineServer.init(conf); timelineServer.start(); store = timelineServer.getTimelineStore(); metricsPublisher = new SystemMetricsPublisher(); metricsPublisher.init(conf); metricsPublisher.start(); }
Example #4
Source File: TestTimelineWebServicesWithSSL.java From big-c with Apache License 2.0 | 6 votes |
@BeforeClass public static void setupServer() throws Exception { conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, "HTTPS_ONLY"); File base = new File(BASEDIR); FileUtil.fullyDelete(base); base.mkdirs(); keystoresDir = new File(BASEDIR).getAbsolutePath(); sslConfDir = KeyStoreTestUtil.getClasspathDir(TestTimelineWebServicesWithSSL.class); KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false); conf.addResource("ssl-server.xml"); conf.addResource("ssl-client.xml"); timelineServer = new ApplicationHistoryServer(); timelineServer.init(conf); timelineServer.start(); store = timelineServer.getTimelineStore(); }
Example #5
Source File: TestAHSWebServices.java From hadoop with Apache License 2.0 | 6 votes |
@BeforeClass public static void setupClass() throws Exception { Configuration conf = new YarnConfiguration(); TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS); TimelineACLsManager aclsManager = new TimelineACLsManager(conf); TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); conf.set(YarnConfiguration.YARN_ADMIN_ACL, "foo"); ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf); ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager); historyManager.init(conf); historyClientService = new ApplicationHistoryClientService(historyManager) { @Override protected void serviceStart() throws Exception { // Do Nothing } }; historyClientService.init(conf); historyClientService.start(); }
Example #6
Source File: TestTimelineACLsManager.java From big-c with Apache License 2.0 | 6 votes |
@Test public void testYarnACLsNotEnabledForEntity() throws Exception { Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false); TimelineACLsManager timelineACLsManager = new TimelineACLsManager(conf); timelineACLsManager.setTimelineStore(new TestTimelineStore()); TimelineEntity entity = new TimelineEntity(); entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER .toString(), "owner"); entity.setDomainId("domain_id_1"); Assert.assertTrue( "Always true when ACLs are not enabled", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("user"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Always true when ACLs are not enabled", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("user"), ApplicationAccessType.MODIFY_APP, entity)); }
Example #7
Source File: TestTimelineWebServices.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testPostEntitiesWithPrimaryFilter() throws Exception { TimelineEntities entities = new TimelineEntities(); TimelineEntity entity = new TimelineEntity(); Map<String, Set<Object>> filters = new HashMap<String, Set<Object>>(); filters.put(TimelineStore.SystemFilter.ENTITY_OWNER.toString(), new HashSet<Object>()); entity.setPrimaryFilters(filters); entity.setEntityId("test id 6"); entity.setEntityType("test type 6"); entity.setStartTime(System.currentTimeMillis()); entities.addEntity(entity); WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("timeline") .queryParam("user.name", "tester") .accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON) .post(ClientResponse.class, entities); TimelinePutResponse putResposne = response.getEntity(TimelinePutResponse.class); Assert.assertEquals(0, putResposne.getErrors().size()); }
Example #8
Source File: TestAHSWebServices.java From big-c with Apache License 2.0 | 6 votes |
@BeforeClass public static void setupClass() throws Exception { Configuration conf = new YarnConfiguration(); TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS); TimelineACLsManager aclsManager = new TimelineACLsManager(conf); TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); conf.set(YarnConfiguration.YARN_ADMIN_ACL, "foo"); ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf); ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager); historyManager.init(conf); historyClientService = new ApplicationHistoryClientService(historyManager) { @Override protected void serviceStart() throws Exception { // Do Nothing } }; historyClientService.init(conf); historyClientService.start(); }
Example #9
Source File: TestTimelineACLsManager.java From hadoop with Apache License 2.0 | 6 votes |
@Test public void testYarnACLsNotEnabledForEntity() throws Exception { Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false); TimelineACLsManager timelineACLsManager = new TimelineACLsManager(conf); timelineACLsManager.setTimelineStore(new TestTimelineStore()); TimelineEntity entity = new TimelineEntity(); entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER .toString(), "owner"); entity.setDomainId("domain_id_1"); Assert.assertTrue( "Always true when ACLs are not enabled", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("user"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Always true when ACLs are not enabled", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("user"), ApplicationAccessType.MODIFY_APP, entity)); }
Example #10
Source File: TestTimelineWebServicesWithSSL.java From hadoop with Apache License 2.0 | 6 votes |
@BeforeClass public static void setupServer() throws Exception { conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.TIMELINE_SERVICE_ENABLED, true); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); conf.set(YarnConfiguration.YARN_HTTP_POLICY_KEY, "HTTPS_ONLY"); File base = new File(BASEDIR); FileUtil.fullyDelete(base); base.mkdirs(); keystoresDir = new File(BASEDIR).getAbsolutePath(); sslConfDir = KeyStoreTestUtil.getClasspathDir(TestTimelineWebServicesWithSSL.class); KeyStoreTestUtil.setupSSLConfig(keystoresDir, sslConfDir, conf, false); conf.addResource("ssl-server.xml"); conf.addResource("ssl-client.xml"); timelineServer = new ApplicationHistoryServer(); timelineServer.init(conf); timelineServer.start(); store = timelineServer.getTimelineStore(); }
Example #11
Source File: MiniYARNCluster.java From big-c with Apache License 2.0 | 5 votes |
@Override protected synchronized void serviceInit(Configuration conf) throws Exception { appHistoryServer = new ApplicationHistoryServer(); conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE, MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); appHistoryServer.init(conf); super.serviceInit(conf); }
Example #12
Source File: MiniYARNClusterSplice.java From spliceengine with GNU Affero General Public License v3.0 | 5 votes |
@Override protected synchronized void serviceInit(Configuration conf) throws Exception { appHistoryServer = new ApplicationHistoryServer(); conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE, MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); appHistoryServer.init(conf); super.serviceInit(conf); }
Example #13
Source File: TestApplicationHistoryServer.java From big-c with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testStartStopServer() throws Exception { ApplicationHistoryServer historyServer = new ApplicationHistoryServer(); Configuration config = new YarnConfiguration(); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0"); try { try { historyServer.init(config); config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT, 0); historyServer.start(); fail(); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains( YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT)); } config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT); historyServer = new ApplicationHistoryServer(); historyServer.init(config); assertEquals(STATE.INITED, historyServer.getServiceState()); assertEquals(5, historyServer.getServices().size()); ApplicationHistoryClientService historyService = historyServer.getClientService(); assertNotNull(historyServer.getClientService()); assertEquals(STATE.INITED, historyService.getServiceState()); historyServer.start(); assertEquals(STATE.STARTED, historyServer.getServiceState()); assertEquals(STATE.STARTED, historyService.getServiceState()); historyServer.stop(); assertEquals(STATE.STOPPED, historyServer.getServiceState()); } finally { historyServer.stop(); } }
Example #14
Source File: TestApplicationHistoryServer.java From big-c with Apache License 2.0 | 5 votes |
@Test(timeout = 240000) public void testFilterOverrides() throws Exception { HashMap<String, String> driver = new HashMap<String, String>(); driver.put("", TimelineAuthenticationFilterInitializer.class.getName()); driver.put(StaticUserWebFilter.class.getName(), TimelineAuthenticationFilterInitializer.class.getName() + "," + StaticUserWebFilter.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(TimelineAuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName() + "," + TimelineAuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName() + ", " + TimelineAuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); for (Map.Entry<String, String> entry : driver.entrySet()) { String filterInitializer = entry.getKey(); String expectedValue = entry.getValue(); ApplicationHistoryServer historyServer = new ApplicationHistoryServer(); Configuration config = new YarnConfiguration(); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0"); try { config.set("hadoop.http.filter.initializers", filterInitializer); historyServer.init(config); historyServer.start(); Configuration tmp = historyServer.getConfig(); assertEquals(expectedValue, tmp.get("hadoop.http.filter.initializers")); } finally { historyServer.stop(); } } }
Example #15
Source File: TestApplicationHistoryClientService.java From big-c with Apache License 2.0 | 5 votes |
@BeforeClass public static void setup() throws Exception { Configuration conf = new YarnConfiguration(); TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS); TimelineACLsManager aclsManager = new TimelineACLsManager(conf); TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager); ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf); ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager); historyManager.init(conf); historyManager.start(); clientService = new ApplicationHistoryClientService(historyManager); }
Example #16
Source File: TestTimelineWebServices.java From big-c with Apache License 2.0 | 5 votes |
private TimelineStore mockTimelineStore() throws Exception { beforeTime = System.currentTimeMillis() - 1; TestMemoryTimelineStore store = new TestMemoryTimelineStore(); store.setup(); return store.getTimelineStore(); }
Example #17
Source File: MiniYARNCluster.java From hadoop with Apache License 2.0 | 5 votes |
@Override protected synchronized void serviceInit(Configuration conf) throws Exception { appHistoryServer = new ApplicationHistoryServer(); conf.setClass(YarnConfiguration.APPLICATION_HISTORY_STORE, MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); conf.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); appHistoryServer.init(conf); super.serviceInit(conf); }
Example #18
Source File: TestTimelineWebServices.java From hadoop with Apache License 2.0 | 5 votes |
private TimelineStore mockTimelineStore() throws Exception { beforeTime = System.currentTimeMillis() - 1; TestMemoryTimelineStore store = new TestMemoryTimelineStore(); store.setup(); return store.getTimelineStore(); }
Example #19
Source File: TestApplicationHistoryClientService.java From hadoop with Apache License 2.0 | 5 votes |
@BeforeClass public static void setup() throws Exception { Configuration conf = new YarnConfiguration(); TimelineStore store = TestApplicationHistoryManagerOnTimelineStore.createStore(MAX_APPS); TimelineACLsManager aclsManager = new TimelineACLsManager(conf); TimelineDataManager dataManager = new TimelineDataManager(store, aclsManager); ApplicationACLsManager appAclsManager = new ApplicationACLsManager(conf); ApplicationHistoryManagerOnTimelineStore historyManager = new ApplicationHistoryManagerOnTimelineStore(dataManager, appAclsManager); historyManager.init(conf); historyManager.start(); clientService = new ApplicationHistoryClientService(historyManager); }
Example #20
Source File: TestApplicationHistoryServer.java From hadoop with Apache License 2.0 | 5 votes |
@Test(timeout = 240000) public void testFilterOverrides() throws Exception { HashMap<String, String> driver = new HashMap<String, String>(); driver.put("", TimelineAuthenticationFilterInitializer.class.getName()); driver.put(StaticUserWebFilter.class.getName(), TimelineAuthenticationFilterInitializer.class.getName() + "," + StaticUserWebFilter.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(TimelineAuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName() + "," + TimelineAuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); driver.put(AuthenticationFilterInitializer.class.getName() + ", " + TimelineAuthenticationFilterInitializer.class.getName(), TimelineAuthenticationFilterInitializer.class.getName()); for (Map.Entry<String, String> entry : driver.entrySet()) { String filterInitializer = entry.getKey(); String expectedValue = entry.getValue(); ApplicationHistoryServer historyServer = new ApplicationHistoryServer(); Configuration config = new YarnConfiguration(); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0"); try { config.set("hadoop.http.filter.initializers", filterInitializer); historyServer.init(config); historyServer.start(); Configuration tmp = historyServer.getConfig(); assertEquals(expectedValue, tmp.get("hadoop.http.filter.initializers")); } finally { historyServer.stop(); } } }
Example #21
Source File: TestApplicationHistoryServer.java From hadoop with Apache License 2.0 | 5 votes |
@Test(timeout = 60000) public void testStartStopServer() throws Exception { ApplicationHistoryServer historyServer = new ApplicationHistoryServer(); Configuration config = new YarnConfiguration(); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STORE, MemoryTimelineStore.class, TimelineStore.class); config.setClass(YarnConfiguration.TIMELINE_SERVICE_STATE_STORE_CLASS, MemoryTimelineStateStore.class, TimelineStateStore.class); config.set(YarnConfiguration.TIMELINE_SERVICE_WEBAPP_ADDRESS, "localhost:0"); try { try { historyServer.init(config); config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT, 0); historyServer.start(); fail(); } catch (IllegalArgumentException e) { Assert.assertTrue(e.getMessage().contains( YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT)); } config.setInt(YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT); historyServer = new ApplicationHistoryServer(); historyServer.init(config); assertEquals(STATE.INITED, historyServer.getServiceState()); assertEquals(5, historyServer.getServices().size()); ApplicationHistoryClientService historyService = historyServer.getClientService(); assertNotNull(historyServer.getClientService()); assertEquals(STATE.INITED, historyService.getServiceState()); historyServer.start(); assertEquals(STATE.STARTED, historyServer.getServiceState()); assertEquals(STATE.STARTED, historyService.getServiceState()); historyServer.stop(); assertEquals(STATE.STOPPED, historyServer.getServiceState()); } finally { historyServer.stop(); } }
Example #22
Source File: ApplicationHistoryServer.java From hadoop with Apache License 2.0 | 4 votes |
/** * @return ApplicationTimelineStore */ @Private @VisibleForTesting public TimelineStore getTimelineStore() { return timelineStore; }
Example #23
Source File: TestMemoryTimelineStore.java From hadoop with Apache License 2.0 | 4 votes |
public TimelineStore getTimelineStore() { return store; }
Example #24
Source File: TestMemoryTimelineStore.java From big-c with Apache License 2.0 | 4 votes |
public TimelineStore getTimelineStore() { return store; }
Example #25
Source File: TestTimelineWebServices.java From big-c with Apache License 2.0 | 4 votes |
@Test public void testGetEntityWithYarnACLsEnabled() throws Exception { AdminACLsManager oldAdminACLsManager = timelineACLsManager.setAdminACLsManager(adminACLsManager); try { TimelineEntities entities = new TimelineEntities(); TimelineEntity entity = new TimelineEntity(); entity.setEntityId("test id 3"); entity.setEntityType("test type 3"); entity.setStartTime(System.currentTimeMillis()); entity.setDomainId("domain_id_1"); entities.addEntity(entity); WebResource r = resource(); ClientResponse response = r.path("ws").path("v1").path("timeline") .queryParam("user.name", "writer_user_1") .accept(MediaType.APPLICATION_JSON) .type(MediaType.APPLICATION_JSON) .post(ClientResponse.class, entities); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); TimelinePutResponse putResponse = response.getEntity(TimelinePutResponse.class); Assert.assertEquals(0, putResponse.getErrors().size()); // verify the system data will not be exposed // 1. No field specification response = r.path("ws").path("v1").path("timeline") .path("test type 3").path("test id 3") .queryParam("user.name", "reader_user_1") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); entity = response.getEntity(TimelineEntity.class); Assert.assertNull(entity.getPrimaryFilters().get( TimelineStore.SystemFilter.ENTITY_OWNER.toString())); // 2. other field response = r.path("ws").path("v1").path("timeline") .path("test type 3").path("test id 3") .queryParam("fields", "relatedentities") .queryParam("user.name", "reader_user_1") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); entity = response.getEntity(TimelineEntity.class); Assert.assertNull(entity.getPrimaryFilters().get( TimelineStore.SystemFilter.ENTITY_OWNER.toString())); // 3. primaryfilters field response = r.path("ws").path("v1").path("timeline") .path("test type 3").path("test id 3") .queryParam("fields", "primaryfilters") .queryParam("user.name", "reader_user_1") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); entity = response.getEntity(TimelineEntity.class); Assert.assertNull(entity.getPrimaryFilters().get( TimelineStore.SystemFilter.ENTITY_OWNER.toString())); // get entity with other user response = r.path("ws").path("v1").path("timeline") .path("test type 3").path("test id 3") .queryParam("user.name", "reader_user_2") .accept(MediaType.APPLICATION_JSON) .get(ClientResponse.class); assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType()); assertEquals(ClientResponse.Status.NOT_FOUND, response.getClientResponseStatus()); } finally { timelineACLsManager.setAdminACLsManager(oldAdminACLsManager); } }
Example #26
Source File: ApplicationHistoryServer.java From hadoop with Apache License 2.0 | 4 votes |
private TimelineStore createTimelineStore( Configuration conf) { return ReflectionUtils.newInstance(conf.getClass( YarnConfiguration.TIMELINE_SERVICE_STORE, LeveldbTimelineStore.class, TimelineStore.class), conf); }
Example #27
Source File: TimelineACLsManager.java From hadoop with Apache License 2.0 | 4 votes |
public void setTimelineStore(TimelineStore store) { this.store = store; }
Example #28
Source File: TestApplicationHistoryManagerOnTimelineStore.java From hadoop with Apache License 2.0 | 4 votes |
public static TimelineStore createStore(int scale) throws Exception { TimelineStore store = new MemoryTimelineStore(); prepareTimelineStore(store, scale); return store; }
Example #29
Source File: TestTimelineACLsManager.java From big-c with Apache License 2.0 | 4 votes |
@Test public void testYarnACLsEnabledForEntity() throws Exception { Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin"); TimelineACLsManager timelineACLsManager = new TimelineACLsManager(conf); timelineACLsManager.setTimelineStore(new TestTimelineStore()); TimelineEntity entity = new TimelineEntity(); entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER .toString(), "owner"); entity.setDomainId("domain_id_1"); Assert.assertTrue( "Owner should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("owner"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Reader should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("reader"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertFalse( "Other shouldn't be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("other"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Admin should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("admin"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Owner should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("owner"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertTrue( "Writer should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("writer"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertFalse( "Other shouldn't be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("other"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertTrue( "Admin should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("admin"), ApplicationAccessType.MODIFY_APP, entity)); }
Example #30
Source File: TestTimelineACLsManager.java From hadoop with Apache License 2.0 | 4 votes |
@Test public void testYarnACLsEnabledForEntity() throws Exception { Configuration conf = new YarnConfiguration(); conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true); conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin"); TimelineACLsManager timelineACLsManager = new TimelineACLsManager(conf); timelineACLsManager.setTimelineStore(new TestTimelineStore()); TimelineEntity entity = new TimelineEntity(); entity.addPrimaryFilter( TimelineStore.SystemFilter.ENTITY_OWNER .toString(), "owner"); entity.setDomainId("domain_id_1"); Assert.assertTrue( "Owner should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("owner"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Reader should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("reader"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertFalse( "Other shouldn't be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("other"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Admin should be allowed to view", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("admin"), ApplicationAccessType.VIEW_APP, entity)); Assert.assertTrue( "Owner should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("owner"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertTrue( "Writer should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("writer"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertFalse( "Other shouldn't be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("other"), ApplicationAccessType.MODIFY_APP, entity)); Assert.assertTrue( "Admin should be allowed to modify", timelineACLsManager.checkAccess( UserGroupInformation.createRemoteUser("admin"), ApplicationAccessType.MODIFY_APP, entity)); }