This is an automated email from the ASF dual-hosted git repository. slfan1989 pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new e5c901823d6 YARN-11788 - Remove unused unit tests. (#7476) Contributed by Shilun Fan. e5c901823d6 is described below commit e5c901823d6e9b0e12f76736bbddd47cffbfb5c9 Author: slfan1989 <55643692+slfan1...@users.noreply.github.com> AuthorDate: Fri Mar 21 16:09:38 2025 +0800 YARN-11788 - Remove unused unit tests. (#7476) Contributed by Shilun Fan. Reviewed-by: Chris Nauroth <cnaur...@apache.org> Signed-off-by: Shilun Fan <slfan1...@apache.org> --- .../applicationsmanager/TestAMLaunchFailure.java | 234 --------------------- .../applicationsmanager/TestASMStateMachine.java | 217 ------------------- .../TestApplicationMasterExpiry.java | 174 --------------- .../TestSchedulerNegotiator.java | 164 --------------- 4 files changed, 789 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java deleted file mode 100644 index 06e20098ed3..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java +++ /dev/null @@ -1,234 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager; - -/* -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; - -import org.junit.Assert; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; -import org.apache.hadoop.yarn.api.records.Container; -import org.apache.hadoop.yarn.api.records.Priority; -import org.apache.hadoop.yarn.api.records.QueueInfo; -import org.apache.hadoop.yarn.api.records.QueueUserACLInfo; -import org.apache.hadoop.yarn.api.records.Resource; -import org.apache.hadoop.yarn.api.records.ResourceRequest; -import org.apache.hadoop.yarn.conf.YarnConfiguration; -import org.apache.hadoop.yarn.event.EventHandler; -import org.apache.hadoop.yarn.factories.RecordFactory; -import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; -import org.apache.hadoop.yarn.server.resourcemanager.ClientRMService; -import org.apache.hadoop.yarn.server.resourcemanager.RMContext; -import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl; -import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; -import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType; -import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation; -import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler; -import org.apache.hadoop.yarn.server.resourcemanager.security.AMRMTokenSecretManager; -import org.apache.hadoop.yarn.util.resource.Resources; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -*/ - -/* a test case that tests the launch failure of a AM */ -public class TestAMLaunchFailure { -// private static final Logger LOG = -// LoggerFactory.getLogger(TestAMLaunchFailure.class); -// private static final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); -// ApplicationsManagerImpl asmImpl; -// YarnScheduler scheduler = new DummyYarnScheduler(); -// ApplicationTokenSecretManager applicationTokenSecretManager = -// new ApplicationTokenSecretManager(); -// private ClientRMService clientService; -// -// private RMContext context; -// -// private static class DummyYarnScheduler implements YarnScheduler { -// private Container container = recordFactory.newRecordInstance(Container.class); -// -// @Override -// public Allocation allocate(ApplicationId applicationId, -// List<ResourceRequest> ask, List<Container> release) throws IOException { -// return new Allocation(Arrays.asList(container), Resources.none()); -// } -// -// @Override -// public QueueInfo getQueueInfo(String queueName, -// boolean includeChildQueues, -// boolean recursive) throws IOException { -// return null; -// } -// -// @Override -// public List<QueueUserACLInfo> getQueueUserAclInfo() { -// return null; -// } -// -// @Override -// public void addApplicationIfAbsent(ApplicationId applicationId, -// ApplicationMaster master, String user, String queue, Priority priority -// , ApplicationStore appStore) -// throws IOException { -// // TODO Auto-generated method stub -// -// } -// -// @Override -// public Resource getMaximumResourceCapability() { -// // TODO Auto-generated method stub -// return null; -// } -// -// @Override -// public Resource getMinimumResourceCapability() { -// // TODO Auto-generated method stub -// return null; -// } -// } -// -// private class DummyApplicationTracker implements EventHandler<ASMEvent<ApplicationTrackerEventType>> { -// public DummyApplicationTracker() { -// context.getDispatcher().register(ApplicationTrackerEventType.class, this); -// } -// @Override -// public void handle(ASMEvent<ApplicationTrackerEventType> event) { -// } -// } -// -// public class ExtApplicationsManagerImpl extends ApplicationsManagerImpl { -// -// private class DummyApplicationMasterLauncher implements EventHandler<ASMEvent<AMLauncherEventType>> { -// private AtomicInteger notify = new AtomicInteger(); -// private AppAttempt app; -// -// public DummyApplicationMasterLauncher(RMContext context) { -// context.getDispatcher().register(AMLauncherEventType.class, this); -// new TestThread().start(); -// } -// @Override -// public void handle(ASMEvent<AMLauncherEventType> appEvent) { -// switch(appEvent.getType()) { -// case LAUNCH: -// LOG.info("LAUNCH called "); -// app = appEvent.getApplication(); -// synchronized (notify) { -// notify.addAndGet(1); -// notify.notify(); -// } -// break; -// } -// } -// -// private class TestThread extends Thread { -// public void run() { -// synchronized(notify) { -// try { -// while (notify.get() == 0) { -// notify.wait(); -// } -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// context.getDispatcher().getEventHandler().handle( -// new ApplicationEvent(ApplicationEventType.LAUNCHED, -// app.getApplicationID())); -// } -// } -// } -// } -// -// public ExtApplicationsManagerImpl( -// ApplicationTokenSecretManager applicationTokenSecretManager, -// YarnScheduler scheduler) { -// super(applicationTokenSecretManager, scheduler, context); -// } -// -// @Override -// protected EventHandler<ASMEvent<AMLauncherEventType>> createNewApplicationMasterLauncher( -// ApplicationTokenSecretManager tokenSecretManager) { -// return new DummyApplicationMasterLauncher(context); -// } -// } -// -// -// @Before -// public void setUp() { -// context = new RMContextImpl(new MemStore()); -// Configuration conf = new Configuration(); -// -// context.getDispatcher().register(ApplicationEventType.class, -// new ResourceManager.ApplicationEventDispatcher(context)); -// -// context.getDispatcher().init(conf); -// context.getDispatcher().start(); -// -// asmImpl = new ExtApplicationsManagerImpl(applicationTokenSecretManager, scheduler); -// clientService = new ClientRMService(context, asmImpl -// .getAmLivelinessMonitor(), asmImpl.getClientToAMSecretManager(), -// scheduler); -// clientService.init(conf); -// new DummyApplicationTracker(); -// conf.setLong(YarnConfiguration.AM_EXPIRY_INTERVAL, 3000L); -// conf.setInt(RMConfig.AM_MAX_RETRIES, 1); -// asmImpl.init(conf); -// asmImpl.start(); -// } -// -// @After -// public void tearDown() { -// asmImpl.stop(); -// } -// -// private ApplicationSubmissionContext createDummyAppContext(ApplicationId appID) { -// ApplicationSubmissionContext context = recordFactory.newRecordInstance(ApplicationSubmissionContext.class); -// context.setApplicationId(appID); -// return context; -// } -// -// @Test -// public void testAMLaunchFailure() throws Exception { -// ApplicationId appID = clientService.getNewApplicationId(); -// ApplicationSubmissionContext submissionContext = createDummyAppContext(appID); -// SubmitApplicationRequest request = recordFactory -// .newRecordInstance(SubmitApplicationRequest.class); -// request.setApplicationSubmissionContext(submissionContext); -// clientService.submitApplication(request); -// AppAttempt application = context.getApplications().get(appID); -// -// while (application.getState() != ApplicationState.FAILED) { -// LOG.info("Waiting for application to go to FAILED state." -// + " Current state is " + application.getState()); -// Thread.sleep(200); -// application = context.getApplications().get(appID); -// } -// Assert.assertEquals(ApplicationState.FAILED, application.getState()); -// } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java deleted file mode 100644 index ef3b65cc1a6..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java +++ /dev/null @@ -1,217 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager; - -/* -import java.util.concurrent.atomic.AtomicInteger; - -import org.junit.Assert; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; -import org.apache.hadoop.yarn.event.EventHandler; -import org.apache.hadoop.yarn.factories.RecordFactory; -import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; -import org.apache.hadoop.yarn.server.resourcemanager.RMContext; -import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl; -import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType; -import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStoreFactory; -import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -*/ - -public class TestASMStateMachine { -// private static final Logger LOG = -// LoggerFactory.getLogger(TestASMStateMachine.class); -// private static RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); -// RMContext context = new RMContextImpl(new MemStore()); -// EventHandler handler; -// private boolean snreceivedCleanUp = false; -// private boolean snAllocateReceived = false; -// private boolean launchCalled = false; -// private boolean addedApplication = false; -// private boolean removedApplication = false; -// private boolean launchCleanupCalled = false; -// private AtomicInteger waitForState = new AtomicInteger(); -// private Configuration conf = new Configuration(); -// @Before -// public void setUp() { -// context.getDispatcher().init(conf); -// context.getDispatcher().start(); -// handler = context.getDispatcher().getEventHandler(); -// new DummyAMLaunchEventHandler(); -// new DummySNEventHandler(); -// new ApplicationTracker(); -// new MockAppplicationMasterInfo(); -// } -// -// @After -// public void tearDown() { -// -// } -// -// private class DummyAMLaunchEventHandler implements EventHandler<ASMEvent<AMLauncherEventType>> { -// AppAttempt application; -// AtomicInteger amsync = new AtomicInteger(0); -// -// public DummyAMLaunchEventHandler() { -// context.getDispatcher().register(AMLauncherEventType.class, this); -// } -// -// @Override -// public void handle(ASMEvent<AMLauncherEventType> event) { -// switch(event.getType()) { -// case LAUNCH: -// launchCalled = true; -// application = event.getApplication(); -// context.getDispatcher().getEventHandler().handle( -// new ApplicationEvent(ApplicationEventType.LAUNCHED, -// application.getApplicationID())); -// break; -// case CLEANUP: -// launchCleanupCalled = true; -// break; -// } -// } -// } -// -// private class DummySNEventHandler implements EventHandler<ASMEvent<SNEventType>> { -// AppAttempt application; -// AtomicInteger snsync = new AtomicInteger(0); -// -// public DummySNEventHandler() { -// context.getDispatcher().register(SNEventType.class, this); -// } -// -// @Override -// public void handle(ASMEvent<SNEventType> event) { -// switch(event.getType()) { -// case RELEASE: -// snreceivedCleanUp = true; -// break; -// case SCHEDULE: -// snAllocateReceived = true; -// application = event.getAppAttempt(); -// context.getDispatcher().getEventHandler().handle( -// new AMAllocatedEvent(application.getApplicationID(), -// application.getMasterContainer())); -// break; -// } -// } -// -// } -// -// private class ApplicationTracker implements EventHandler<ASMEvent<ApplicationTrackerEventType>> { -// public ApplicationTracker() { -// context.getDispatcher().register(ApplicationTrackerEventType.class, this); -// } -// -// @Override -// public void handle(ASMEvent<ApplicationTrackerEventType> event) { -// switch (event.getType()) { -// case ADD: -// addedApplication = true; -// break; -// case REMOVE: -// removedApplication = true; -// break; -// } -// } -// } -// -// private class MockAppplicationMasterInfo implements -// EventHandler<ApplicationEvent> { -// -// MockAppplicationMasterInfo() { -// context.getDispatcher().register(ApplicationEventType.class, this); -// } -// @Override -// public void handle(ApplicationEvent event) { -// LOG.info("The event type is " + event.getType()); -// } -// } -// -// private void waitForState( ApplicationState -// finalState, AppAttemptImpl masterInfo) throws Exception { -// int count = 0; -// while(masterInfo.getState() != finalState && count < 10) { -// Thread.sleep(500); -// count++; -// } -// Assert.assertEquals(finalState, masterInfo.getState()); -// } -// -// /* Test the state machine. -// * -// */ -// @Test -// public void testStateMachine() throws Exception { -// ApplicationSubmissionContext submissioncontext = recordFactory.newRecordInstance(ApplicationSubmissionContext.class); -// submissioncontext.setApplicationId(recordFactory.newRecordInstance(ApplicationId.class)); -// submissioncontext.getApplicationId().setId(1); -// submissioncontext.getApplicationId().setClusterTimestamp(System.currentTimeMillis()); -// -// AppAttemptImpl masterInfo = new AppAttemptImpl(context, -// conf, "dummyuser", submissioncontext, "dummyToken", StoreFactory -// .createVoidAppStore(), new AMLivelinessMonitor(context -// .getDispatcher().getEventHandler())); -// -// context.getDispatcher().register(ApplicationEventType.class, masterInfo); -// handler.handle(new ApplicationEvent( -// ApplicationEventType.ALLOCATE, submissioncontext.getApplicationId())); -// -// waitForState(ApplicationState.LAUNCHED, masterInfo); -// Assert.assertTrue(snAllocateReceived); -// Assert.assertTrue(launchCalled); -// Assert.assertTrue(addedApplication); -// handler -// .handle(new AMRegistrationEvent(masterInfo.getMaster())); -// waitForState(ApplicationState.RUNNING, masterInfo); -// Assert.assertEquals(ApplicationState.RUNNING, masterInfo.getState()); -// -// ApplicationStatus status = recordFactory -// .newRecordInstance(ApplicationStatus.class); -// status.setApplicationId(masterInfo.getApplicationID()); -// handler.handle(new AMStatusUpdateEvent(status)); -// -// /* check if the state is still RUNNING */ -// -// Assert.assertEquals(ApplicationState.RUNNING, masterInfo.getState()); -// -// handler.handle(new AMFinishEvent(masterInfo.getApplicationID(), -// ApplicationState.COMPLETED, "", "")); -// waitForState(ApplicationState.COMPLETED, masterInfo); -// Assert.assertEquals(ApplicationState.COMPLETED, masterInfo.getState()); -// /* check if clean up is called for everyone */ -// Assert.assertTrue(launchCleanupCalled); -// Assert.assertTrue(snreceivedCleanUp); -// Assert.assertTrue(removedApplication); -// -// /* check if expiry doesnt make it failed */ -// handler.handle(new ApplicationEvent(ApplicationEventType.EXPIRE, -// masterInfo.getApplicationID())); -// Assert.assertEquals(ApplicationState.COMPLETED, masterInfo.getState()); -// } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java deleted file mode 100644 index beaec79fa38..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java +++ /dev/null @@ -1,174 +0,0 @@ -/** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager; - -/* -import java.util.concurrent.atomic.AtomicInteger; - -import org.junit.Assert; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; -import org.apache.hadoop.yarn.conf.YarnConfiguration; -import org.apache.hadoop.yarn.event.EventHandler; -import org.apache.hadoop.yarn.factories.RecordFactory; -import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider; -import org.apache.hadoop.yarn.server.resourcemanager.RMContext; -import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl; -import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; -import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType; -import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor; -import org.junit.Before; -import org.junit.Test; -*/ - -/** - * A test case that tests the expiry of the application master. - * More tests can be added to this. - */ -public class TestApplicationMasterExpiry { -// private static final Logger LOG = -// LoggerFactory.getLogger(TestApplicationMasterExpiry.class); -// private static RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); -// -// private final RMContext context = new RMContextImpl(new MemStore()); -// private AMLivelinessMonitor amLivelinessMonitor; -// -// @Before -// public void setUp() { -// new DummyApplicationTracker(); -// new DummySN(); -// new DummyLauncher(); -// new ApplicationEventTypeListener(); -// Configuration conf = new Configuration(); -// context.getDispatcher().register(ApplicationEventType.class, -// new ResourceManager.ApplicationEventDispatcher(context)); -// context.getDispatcher().init(conf); -// context.getDispatcher().start(); -// conf.setLong(YarnConfiguration.AM_EXPIRY_INTERVAL, 1000L); -// amLivelinessMonitor = new AMLivelinessMonitor(this.context -// .getDispatcher().getEventHandler()); -// amLivelinessMonitor.init(conf); -// amLivelinessMonitor.start(); -// } -// -// private class DummyApplicationTracker implements EventHandler<ASMEvent<ApplicationTrackerEventType>> { -// DummyApplicationTracker() { -// context.getDispatcher().register(ApplicationTrackerEventType.class, this); -// } -// @Override -// public void handle(ASMEvent<ApplicationTrackerEventType> event) { -// } -// } -// -// private AtomicInteger expiry = new AtomicInteger(); -// private boolean expired = false; -// -// private class ApplicationEventTypeListener implements -// EventHandler<ApplicationEvent> { -// ApplicationEventTypeListener() { -// context.getDispatcher().register(ApplicationEventType.class, this); -// } -// @Override -// public void handle(ApplicationEvent event) { -// switch(event.getType()) { -// case EXPIRE: -// expired = true; -// LOG.info("Received expiry from application " + event.getApplicationId()); -// synchronized(expiry) { -// expiry.addAndGet(1); -// } -// } -// } -// } -// -// private class DummySN implements EventHandler<ASMEvent<SNEventType>> { -// DummySN() { -// context.getDispatcher().register(SNEventType.class, this); -// } -// @Override -// public void handle(ASMEvent<SNEventType> event) { -// } -// } -// -// private class DummyLauncher implements EventHandler<ASMEvent<AMLauncherEventType>> { -// DummyLauncher() { -// context.getDispatcher().register(AMLauncherEventType.class, this); -// } -// @Override -// public void handle(ASMEvent<AMLauncherEventType> event) { -// } -// } -// -// private void waitForState(AppAttempt application, ApplicationState -// finalState) throws Exception { -// int count = 0; -// while(application.getState() != finalState && count < 10) { -// Thread.sleep(500); -// count++; -// } -// Assert.assertEquals(finalState, application.getState()); -// } -// -// @Test -// public void testAMExpiry() throws Exception { -// ApplicationSubmissionContext submissionContext = recordFactory -// .newRecordInstance(ApplicationSubmissionContext.class); -// submissionContext.setApplicationId(recordFactory -// .newRecordInstance(ApplicationId.class)); -// submissionContext.getApplicationId().setClusterTimestamp( -// System.currentTimeMillis()); -// submissionContext.getApplicationId().setId(1); -// -// ApplicationStore appStore = context.getApplicationsStore() -// .createApplicationStore(submissionContext.getApplicationId(), -// submissionContext); -// AppAttempt application = new AppAttemptImpl(context, -// new Configuration(), "dummy", submissionContext, "dummytoken", appStore, -// amLivelinessMonitor); -// context.getApplications() -// .put(application.getApplicationID(), application); -// -// this.context.getDispatcher().getSyncHandler().handle( -// new ApplicationEvent(ApplicationEventType.ALLOCATE, submissionContext -// .getApplicationId())); -// -// waitForState(application, ApplicationState.ALLOCATING); -// -// this.context.getDispatcher().getEventHandler().handle( -// new AMAllocatedEvent(application.getApplicationID(), -// application.getMasterContainer())); -// -// waitForState(application, ApplicationState.LAUNCHING); -// -// this.context.getDispatcher().getEventHandler().handle( -// new ApplicationEvent(ApplicationEventType.LAUNCHED, -// application.getApplicationID())); -// synchronized(expiry) { -// while (expiry.get() == 0) { -// expiry.wait(1000); -// } -// } -// Assert.assertTrue(expired); -// } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java deleted file mode 100644 index fedbf2b353d..00000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java +++ /dev/null @@ -1,164 +0,0 @@ -/** -* Licensed to the Apache Software Foundation (ASF) under one -* or more contributor license agreements. See the NOTICE file -* distributed with this work for additional information -* regarding copyright ownership. The ASF licenses this file -* to you under the Apache License, Version 2.0 (the -* "License"); you may not use this file except in compliance -* with the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -package org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager; - - -public class TestSchedulerNegotiator { -// private static RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null); -// private SchedulerNegotiator schedulerNegotiator; -// private DummyScheduler scheduler; -// private final int testNum = 99999; -// -// private final RMContext context = new RMContextImpl(new MemStore()); -// AppAttemptImpl masterInfo; -// private EventHandler handler; -// private Configuration conf = new Configuration(); -// private class DummyScheduler implements ResourceScheduler { -// @Override -// public Allocation allocate(ApplicationId applicationId, -// List<ResourceRequest> ask, List<Container> release) throws IOException { -// ArrayList<Container> containers = new ArrayList<Container>(); -// Container container = recordFactory.newRecordInstance(Container.class); -// container.setId(recordFactory.newRecordInstance(ContainerId.class)); -// container.getId().setAppId(applicationId); -// container.getId().setId(testNum); -// containers.add(container); -// return new Allocation(containers, Resources.none()); -// } -// -// -// @Override -// public void nodeUpdate(RMNode nodeInfo, -// Map<String, List<Container>> containers) { -// } -// -// @Override -// public void removeNode(RMNode node) { -// } -// -// @Override -// public void handle(ASMEvent<ApplicationTrackerEventType> event) { -// } -// -// @Override -// public QueueInfo getQueueInfo(String queueName, -// boolean includeChildQueues, -// boolean recursive) throws IOException { -// return null; -// } -// @Override -// public List<QueueUserACLInfo> getQueueUserAclInfo() { -// return null; -// } -// @Override -// public void addApplicationIfAbsent(ApplicationId applicationId, -// ApplicationMaster master, String user, String queue, Priority priority, -// ApplicationStore store) -// throws IOException { -// } -// -// -// @Override -// public void addNode(RMNode nodeInfo) { -// } -// -// -// @Override -// public void recover(RMState state) throws Exception { -// } -// -// -// @Override -// public void reinitialize(Configuration conf, -// ContainerTokenSecretManager secretManager, RMContext rmContext) -// throws IOException { -// } -// -// -// @Override -// public Resource getMaximumResourceCapability() { -// // TODO Auto-generated method stub -// return null; -// } -// -// -// @Override -// public Resource getMinimumResourceCapability() { -// // TODO Auto-generated method stub -// return null; -// } -// } -// -// @Before -// public void setUp() { -// scheduler = new DummyScheduler(); -// schedulerNegotiator = new SchedulerNegotiator(context, scheduler); -// schedulerNegotiator.init(conf); -// schedulerNegotiator.start(); -// handler = context.getDispatcher().getEventHandler(); -// context.getDispatcher().init(conf); -// context.getDispatcher().start(); -// } -// -// @After -// public void tearDown() { -// schedulerNegotiator.stop(); -// } -// -// public void waitForState(ApplicationState state, AppAttemptImpl info) { -// int count = 0; -// while (info.getState() != state && count < 100) { -// try { -// Thread.sleep(50); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// count++; -// } -// Assert.assertEquals(state, info.getState()); -// } -// -// private class DummyEventHandler implements EventHandler<ASMEvent<AMLauncherEventType>> { -// @Override -// public void handle(ASMEvent<AMLauncherEventType> event) { -// } -// } -// -// @Test -// public void testSchedulerNegotiator() throws Exception { -// ApplicationSubmissionContext submissionContext = recordFactory.newRecordInstance(ApplicationSubmissionContext.class); -// submissionContext.setApplicationId(recordFactory.newRecordInstance(ApplicationId.class)); -// submissionContext.getApplicationId().setClusterTimestamp(System.currentTimeMillis()); -// submissionContext.getApplicationId().setId(1); -// -// masterInfo = new AppAttemptImpl(this.context, this.conf, "dummy", -// submissionContext, "dummyClientToken", StoreFactory -// .createVoidAppStore(), new AMLivelinessMonitor(context -// .getDispatcher().getEventHandler())); -// context.getDispatcher().register(ApplicationEventType.class, masterInfo); -// context.getDispatcher().register(ApplicationTrackerEventType.class, scheduler); -// context.getDispatcher().register(AMLauncherEventType.class, -// new DummyEventHandler()); -// handler.handle(new ApplicationEvent( -// ApplicationEventType.ALLOCATE, submissionContext.getApplicationId())); -// waitForState(ApplicationState.LAUNCHING, masterInfo); // LAUNCHING because ALLOCATED automatically movesto LAUNCHING for now. -// Container container = masterInfo.getMasterContainer(); -// Assert.assertTrue(container.getId().getId() == testNum); -// } -} --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org