### Question:
SystemArguments { public static ProfileId getProfileIdForProgram(ProgramId programId, Map<String, String> args) { if (isProfileAllowed(programId.getType())) { return getProfileIdFromArgs(programId.getNamespaceId(), args).orElse(ProfileId.NATIVE); } return ProfileId.NATIVE; } private  SystemArguments(); static Map<String, Level> getLogLevels(Map<String, String> args); static boolean isProgramMetricsEnabled(Map<String, String> args, boolean defaultValue); static void setLogLevel(Arguments args, LogAppenderInitializer initializer); static void setTransactionTimeout(Map<String, String> args, int timeout); static int getTransactionTimeout(Map<String, String> args, CConfiguration cConf); static void validateTransactionTimeout(Map<String, String> args, CConfiguration cConf); static void validateTransactionTimeout(Map<String, String> args, CConfiguration cConf,
                                                @Nullable String scope, @Nullable String name); static RetryStrategy getRetryStrategy(Map<String, String> args, ProgramType programType,
                                               CConfiguration cConf); static Resources getResources(Arguments args, @Nullable Resources defaultResources); static Resources getResources(Map<String, String> args, @Nullable Resources defaultResources); static Map<String, String> getTwillApplicationConfigs(Map<String, String> args); static Map<String, String> getTwillContainerConfigs(Map<String, String> args, int containerMemory); static T configureNettyHttpService(Map<String, String> args, T builder); static ProfileId getProfileIdForProgram(ProgramId programId, Map<String, String> args); static boolean isProfileAllowed(ProgramType programType); static Optional<ProfileId> getProfileIdFromArgs(NamespaceId namespaceId, Map<String, String> args); static void addProfileArgs(Map<String, String> args, Profile profile); static String getProfileProvisioner(Map<String, String> args); static RuntimeMonitorType getRuntimeMonitorType(CConfiguration cConf, ProgramOptions programOptions); static Map<String, String> getProfileProperties(Map<String, String> args); static final String MEMORY_KEY; static final String CORES_KEY; static final String RESERVED_MEMORY_KEY_OVERRIDE; static final String TRANSACTION_TIMEOUT; static final String METRICS_ENABLED; static final String METRICS_CONTEXT_TASK_INCLUDED; static final String SERVICE_THREADS; static final String SERVICE_THREAD_KEEPALIVE_SECS; static final String PROFILE_NAME; static final String PROFILE_PROVISIONER; static final String PROFILE_PROPERTIES_PREFIX; static final String RUNTIME_KEYTAB_PATH; static final String RUNTIME_PRINCIPAL_NAME; static final String RUNTIME_MONITOR_TYPE; }### Answer:
@Test public void testGetProgramProfile() { ProfileId profileId = NamespaceId.DEFAULT.profile("p"); Map<String, String> args = Collections.singletonMap(SystemArguments.PROFILE_NAME, profileId.getScopedName()); ApplicationId appId = NamespaceId.DEFAULT.app("a"); ProgramId mrId = appId.mr("mr"); ProgramId serviceId = appId.service("serv"); ProgramId sparkId = appId.spark("spark"); ProgramId workerId = appId.worker("worker"); ProgramId workflowID = appId.workflow("wf"); Assert.assertEquals(profileId, SystemArguments.getProfileIdForProgram(mrId, args)); Assert.assertEquals(ProfileId.NATIVE, SystemArguments.getProfileIdForProgram(serviceId, args)); Assert.assertEquals(profileId, SystemArguments.getProfileIdForProgram(sparkId, args)); Assert.assertEquals(profileId, SystemArguments.getProfileIdForProgram(workerId, args)); Assert.assertEquals(profileId, SystemArguments.getProfileIdForProgram(workflowID, args)); }