private void writeActivation(Activation activation, String tagName, XmlSerializer serializer) throws java.io.IOException { serializer.startTag(NAMESPACE, tagName); flush(serializer); StringBuffer b = b(serializer); int start = b.length(); if (activation.isActiveByDefault() != false) { writeValue(serializer, "activeByDefault", String.valueOf(activation.isActiveByDefault()), activation); } if (activation.getJdk() != null) { writeValue(serializer, "jdk", activation.getJdk(), activation); } if (activation.getOs() != null) { writeActivationOS((ActivationOS) activation.getOs(), "os", serializer); } if (activation.getProperty() != null) { writeActivationProperty((ActivationProperty) activation.getProperty(), "property", serializer); } if (activation.getFile() != null) { writeActivationFile((ActivationFile) activation.getFile(), "file", serializer); } serializer.endTag(NAMESPACE, tagName).flush(); logLocation(activation, "", start, b.length()); }
private void visitProfileActivation( ModelVisitor visitor, Activation activation ) { ActivationOS os = activation.getOs(); if ( os != null ) { visitor.visitProfileActivationO( os ); os = visitor.replaceProfileActivationO( os ); activation.setOs( os ); } ActivationProperty property = activation.getProperty(); if ( property != null ) { visitor.visitProfileActivationProperty( property ); property = visitor.replaceProfileActivationProperty( property ); activation.setProperty( property ); } ActivationFile file = activation.getFile(); if ( file != null ) { visitor.visitProfileActivationFile( file ); file = visitor.replaceProfileActivationFile( file ); activation.setFile( file ); } }
public boolean isActive( Profile profile ) { Activation activation = profile.getActivation(); ActivationOS os = activation.getOs(); boolean result = ensureAtLeastOneNonNull( os ); if ( result && os.getFamily() != null ) { result = determineFamilyMatch( os.getFamily() ); } if ( result && os.getName() != null ) { result = determineNameMatch( os.getName() ); } if ( result && os.getArch() != null ) { result = determineArchMatch( os.getArch() ); } if ( result && os.getVersion() != null ) { result = determineVersionMatch( os.getVersion() ); } return result; }
public void addProfile( Profile profile ) { String profileId = profile.getId(); Profile existing = (Profile) profilesById.get( profileId ); if ( existing != null ) { logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource() + ") with new instance from source: " + profile.getSource() ); } profilesById.put( profile.getId(), profile ); Activation activation = profile.getActivation(); if ( activation != null && activation.isActiveByDefault() ) { activateAsDefault( profileId ); } }
@Test public void shouldResolveDependencyFromDefaultProfile() { Model bar = pom().artifactId("bar").create(repoBarDir); Model foo = pom().artifactId("foo").create(repoFooDir); Activation fooProfileActivation = new Activation(); fooProfileActivation.setActiveByDefault(true); Profile fooProfile = new Profile(); fooProfile.setId("fooProfile"); fooProfile.setActivation(fooProfileActivation); fooProfile.addDependency(dependency().to(bar).build()); foo.addProfile(fooProfile); createArtifact(repoFooDir, foo); validationExecutor.execute(ctx); assertSuccess(); assertLocalRepoContains(foo); assertLocalRepoContains(bar); }
@Test public void shouldResolveDependencyFromActiveProfile() { Model bar = pom().artifactId("bar").create(repoBarDir); Model foo = pom().artifactId("foo").create(repoFooDir); Activation fooProfileActivation = new Activation(); fooProfileActivation.setJdk("!1.0"); Profile fooProfile = new Profile(); fooProfile.setId("fooProfile"); fooProfile.setActivation(fooProfileActivation); fooProfile.addDependency(dependency().to(bar).build()); foo.addProfile(fooProfile); createArtifact(repoFooDir, foo); validationExecutor.execute(ctx); assertSuccess(); assertLocalRepoContains(foo); assertLocalRepoContains(bar); }
@Test public void shouldFindMissingDependencyFromActiveProfile() { Model bar = pom().artifactId("bar").model(); Model foo = pom().artifactId("foo").create(repoFooDir); Activation fooProfileActivation = new Activation(); fooProfileActivation.setJdk("!1.0"); Profile fooProfile = new Profile(); fooProfile.setId("fooProfile"); fooProfile.setActivation(fooProfileActivation); fooProfile.addDependency(dependency().to(bar).build()); foo.addProfile(fooProfile); createArtifact(repoFooDir, foo); validationExecutor.execute(ctx); assertExpectedException(ArtifactNotFoundException.class, "Could not find artifact com.acme:bar:jar:1.0"); }
private List<String> activateProfilesWithProperties(MavenProject mavenProject, List<String> activeProfileIds) { if (mavenProject == null) return activeProfileIds; List<String> result = new ArrayList<String>(); if (activeProfileIds != null) { result.addAll(activeProfileIds); } for (Profile profile : mavenProject.getModel().getProfiles()) { Activation activation = profile.getActivation(); if (activation != null) { ActivationProperty property = activation.getProperty(); if (property != null) { String name = property.getName(); if (name != null) { String value; if (name.startsWith("!")) { value = propertiesManager.getPropertyValue(name.substring(1)); } else { value = propertiesManager.getPropertyValue(name); } if (value != null) { if (!name.startsWith("!") && value.equals(property.getValue()) || name.startsWith("!") && !value.equals(property.getValue())) { result.add(profile.getId()); } } } } } } return result; }
/** * @param activation is the {@link Activation} of a {@link Profile}. * @return <code>true</code> if the given {@link Activation} is build-time driven, <code>false</code> otherwise (if * it is triggered by OS or JDK). */ protected static boolean isBuildTimeDriven( Activation activation ) { if ( activation == null ) { return true; } if ( StringUtils.isEmpty( activation.getJdk() ) && activation.getOs() == null ) { return true; } return false; }
private static MavenActivation convertActivation(Activation activation) { if (activation == null) { return null; } MavenActivation result = new MavenActivation(); result.setActiveByDefault(activation.isActiveByDefault()); result.setFile(convertFileActivation(activation.getFile())); result.setJdk(activation.getJdk()); result.setOs(convertOsActivation(activation.getOs())); result.setProperty(convertPropertyActivation(activation.getProperty())); return result; }
private static Activation convertToMavenActivation(MavenActivation activation) { if (activation != null) { Activation result = new Activation(); result.setActiveByDefault(activation.isActiveByDefault()); result.setFile(convertToMavenActivationFile(activation.getFile())); result.setJdk(activation.getJdk()); result.setOs(convertToMavenActivationOs(activation.getOs())); result.setProperty(convertToMavenActivationProperty(activation.getProperty())); return result; } return null; }
@SuppressWarnings({"unchecked"}) public void transformableWithDiscardActiveReference() throws IOException { PomTransformer pomTransformer = new PomTransformer(transformablePomAsString, PomCleanupPolicy.discard_active_reference); String transformedPom = pomTransformer.transform(); Model pom = MavenModelUtils.stringToMavenModel(transformedPom); List repositoriesList = pom.getRepositories(); List pluginsRepositoriesList = pom.getPluginRepositories(); assertEmptyList(repositoriesList, pluginsRepositoriesList); List<Profile> pomProfiles = pom.getProfiles(); for (Profile profile : pomProfiles) { boolean activeByDefault = false; Activation activation = profile.getActivation(); if (activation != null) { activeByDefault = activation.isActiveByDefault(); } List profileRepositories = profile.getRepositories(); List profilePluginsRepositories = profile.getPluginRepositories(); if (activeByDefault) { assertEmptyList(profileRepositories, profilePluginsRepositories); } else { assertNotEmptyList(profileRepositories, profilePluginsRepositories); } } assertTrue(transformablePomAsString.contains("This is a comment")); compareChecksums(transformablePomAsString, transformedPom, false); }
/** * Add the profile to the list of profiles. If an existing profile has the same * id it is removed first. * * @param profiles Existing profiles * @param profile Target profile to add */ void addProfile( final List<Profile> profiles, final Profile profile ) { final Iterator<Profile> i = profiles.iterator(); while ( i.hasNext() ) { final Profile p = i.next(); if ( profile.getId() .equals( p.getId() ) ) { logger.debug( "Removing local profile {} ", p ); i.remove(); // Don't break out of the loop so we can check for active profiles } // If we have injected profiles and one of the current profiles is using // activeByDefault it will get mistakingly deactivated due to the semantics // of activeByDefault. Therefore replace the activation. if (p.getActivation() != null && p.getActivation().isActiveByDefault()) { logger.warn( "Profile {} is activeByDefault", p ); final Activation replacement = new Activation(); final ActivationProperty replacementProp = new ActivationProperty(); replacementProp.setName( "!disableProfileActivation" ); replacement.setProperty( replacementProp ); p.setActivation( replacement ); } } logger.debug( "Adding profile {}", profile ); profiles.add( profile ); }
public boolean isActive( Profile profile ) throws ProfileActivationException { Activation activation = profile.getActivation(); String jdk = activation.getJdk(); // null case is covered by canDetermineActivation(), so we can do a straight startsWith() here. if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) ) { try { return matchJdkVersionRange( jdk ); } catch ( InvalidVersionSpecificationException e ) { throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': " + e.getMessage() ); } } boolean reverse = false; if ( jdk.startsWith( "!" ) ) { reverse = true; jdk = jdk.substring( 1 ); } if ( getJdkVersion().startsWith( jdk ) ) { return !reverse; } else { return reverse; } }
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems ) { Activation activation = profile.getActivation(); if ( activation == null ) { return false; } String jdk = activation.getJdk(); if ( jdk == null ) { return false; } String version = context.getSystemProperties().get( "java.version" ); if ( version == null || version.length() <= 0 ) { problems.add( new ModelProblemCollectorRequest( Severity.ERROR, Version.BASE ) .setMessage( "Failed to determine Java version for profile " + profile.getId() ) .setLocation(activation.getLocation( "jdk" ) ) ); return false; } if ( jdk.startsWith( "!" ) ) { return !version.startsWith( jdk.substring( 1 ) ); } else if ( isRange( jdk ) ) { return isInRange( version, getRange( jdk ) ); } else { return version.startsWith( jdk ); } }
public boolean isActive( Profile profile, ProfileActivationContext context, ModelProblemCollector problems ) { Activation activation = profile.getActivation(); if ( activation == null ) { return false; } ActivationOS os = activation.getOs(); if ( os == null ) { return false; } boolean active = ensureAtLeastOneNonNull( os ); if ( active && os.getFamily() != null ) { active = determineFamilyMatch( os.getFamily() ); } if ( active && os.getName() != null ) { active = determineNameMatch( os.getName() ); } if ( active && os.getArch() != null ) { active = determineArchMatch( os.getArch() ); } if ( active && os.getVersion() != null ) { active = determineVersionMatch( os.getVersion() ); } return active; }
private Profile newProfile( String jdkVersion ) { Activation a = new Activation(); a.setJdk( jdkVersion ); Profile p = new Profile(); p.setActivation( a ); return p; }
public void testNullSafe() throws Exception { Profile p = new Profile(); assertActivation( false, p, newContext( null, null ) ); p.setActivation( new Activation() ); assertActivation( false, p, newContext( null, null ) ); }
private Profile newProfile( String key, String value ) { ActivationProperty ap = new ActivationProperty(); ap.setName( key ); ap.setValue( value ); Activation a = new Activation(); a.setProperty( ap ); Profile p = new Profile(); p.setActivation( a ); return p; }
@Override public Activation replaceProfileActivation( Activation activation ) { return activation; }
@Override public void visitProfileActivation( Activation activation ) { }
public static ProfileApplicationResult applyProfiles(MavenModel model, File basedir, MavenExplicitProfiles explicitProfiles, Collection<String> alwaysOnProfiles) throws RemoteException { Model nativeModel = MavenModelConverter.toNativeModel(model); Collection<String> enabledProfiles = explicitProfiles.getEnabledProfiles(); Collection<String> disabledProfiles = explicitProfiles.getDisabledProfiles(); List<Profile> activatedPom = new ArrayList<Profile>(); List<Profile> activatedExternal = new ArrayList<Profile>(); List<Profile> activeByDefault = new ArrayList<Profile>(); List<Profile> rawProfiles = nativeModel.getProfiles(); List<Profile> expandedProfilesCache = null; List<Profile> deactivatedProfiles = new ArrayList<Profile>(); for (int i = 0; i < rawProfiles.size(); i++) { Profile eachRawProfile = rawProfiles.get(i); if (disabledProfiles.contains(eachRawProfile.getId())) { deactivatedProfiles.add(eachRawProfile); continue; } boolean shouldAdd = enabledProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId()); Activation activation = eachRawProfile.getActivation(); if (activation != null) { if (activation.isActiveByDefault()) { activeByDefault.add(eachRawProfile); } // expand only if necessary if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles(); Profile eachExpandedProfile = expandedProfilesCache.get(i); for (ProfileActivator eachActivator : getProfileActivators(basedir)) { try { if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) { shouldAdd = true; break; } } catch (ProfileActivationException e) { Maven3ServerGlobals.getLogger().warn(e); } } } if (shouldAdd) { if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) { activatedPom.add(eachRawProfile); } else { activatedExternal.add(eachRawProfile); } } } List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom); activatedProfiles.addAll(activatedExternal); for (Profile each : activatedProfiles) { new DefaultProfileInjector().injectProfile(nativeModel, each, null, null); } return new ProfileApplicationResult(MavenModelConverter.convertModel(nativeModel, null), new MavenExplicitProfiles(collectProfilesIds(activatedProfiles), collectProfilesIds(deactivatedProfiles)) ); }
public static ProfileApplicationResult applyProfiles(MavenModel model, File basedir, MavenExplicitProfiles explicitProfiles, Collection<String> alwaysOnProfiles) throws RemoteException { Model nativeModel = Maven2ModelConverter.toNativeModel(model); Collection<String> enabledProfiles = explicitProfiles.getEnabledProfiles(); Collection<String> disabledProfiles = explicitProfiles.getDisabledProfiles(); List<Profile> activatedPom = new ArrayList<Profile>(); List<Profile> activatedExternal = new ArrayList<Profile>(); List<Profile> activeByDefault = new ArrayList<Profile>(); List<Profile> rawProfiles = nativeModel.getProfiles(); List<Profile> expandedProfilesCache = null; List<Profile> deactivatedProfiles = new ArrayList<Profile>(); for (int i = 0; i < rawProfiles.size(); i++) { Profile eachRawProfile = rawProfiles.get(i); if (disabledProfiles.contains(eachRawProfile.getId())) { deactivatedProfiles.add(eachRawProfile); continue; } boolean shouldAdd = enabledProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId()); Activation activation = eachRawProfile.getActivation(); if (activation != null) { if (activation.isActiveByDefault()) { activeByDefault.add(eachRawProfile); } // expand only if necessary if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles(); Profile eachExpandedProfile = expandedProfilesCache.get(i); for (ProfileActivator eachActivator : getProfileActivators(basedir)) { try { if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) { shouldAdd = true; break; } } catch (ProfileActivationException e) { Maven2ServerGlobals.getLogger().warn(e); } } } if (shouldAdd) { if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) { activatedPom.add(eachRawProfile); } else { activatedExternal.add(eachRawProfile); } } } List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom); activatedProfiles.addAll(activatedExternal); for (Profile each : activatedProfiles) { new DefaultProfileInjector().inject(each, nativeModel); } return new ProfileApplicationResult(Maven2ModelConverter.convertModel(nativeModel, null), new MavenExplicitProfiles(collectProfilesIds(activatedProfiles), collectProfilesIds(deactivatedProfiles)) ); }
public static ProfileApplicationResult applyProfiles(MavenModel model, File basedir, Collection<String> explicitProfiles, Collection<String> alwaysOnProfiles) throws RemoteException { Model nativeModel = MavenModelConverter.toNativeModel(model); List<Profile> activatedPom = new ArrayList<Profile>(); List<Profile> activatedExternal = new ArrayList<Profile>(); List<Profile> activeByDefault = new ArrayList<Profile>(); List<Profile> rawProfiles = nativeModel.getProfiles(); List<Profile> expandedProfilesCache = null; for (int i = 0; i < rawProfiles.size(); i++) { Profile eachRawProfile = rawProfiles.get(i); boolean shouldAdd = explicitProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId()); Activation activation = eachRawProfile.getActivation(); if (activation != null) { if (activation.isActiveByDefault()) { activeByDefault.add(eachRawProfile); } // expand only if necessary if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles(); Profile eachExpandedProfile = expandedProfilesCache.get(i); for (ProfileActivator eachActivator : getProfileActivators(basedir)) { try { if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) { shouldAdd = true; break; } } catch (ProfileActivationException e) { Maven3ServerGlobals.getLogger().warn(e); } } } if (shouldAdd) { if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) { activatedPom.add(eachRawProfile); } else { activatedExternal.add(eachRawProfile); } } } List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom); activatedProfiles.addAll(activatedExternal); for (Profile each : activatedProfiles) { new DefaultProfileInjector().injectProfile(nativeModel, each, null, null); } return new ProfileApplicationResult(MavenModelConverter.convertModel(nativeModel, null), collectProfilesIds(activatedProfiles)); }
public static ProfileApplicationResult applyProfiles(MavenModel model, File basedir, Collection<String> explicitProfiles, Collection<String> alwaysOnProfiles) throws RemoteException { Model nativeModel = Maven2ModelConverter.toNativeModel(model); List<Profile> activatedPom = new ArrayList<Profile>(); List<Profile> activatedExternal = new ArrayList<Profile>(); List<Profile> activeByDefault = new ArrayList<Profile>(); List<Profile> rawProfiles = nativeModel.getProfiles(); List<Profile> expandedProfilesCache = null; for (int i = 0; i < rawProfiles.size(); i++) { Profile eachRawProfile = rawProfiles.get(i); boolean shouldAdd = explicitProfiles.contains(eachRawProfile.getId()) || alwaysOnProfiles.contains(eachRawProfile.getId()); Activation activation = eachRawProfile.getActivation(); if (activation != null) { if (activation.isActiveByDefault()) { activeByDefault.add(eachRawProfile); } // expand only if necessary if (expandedProfilesCache == null) expandedProfilesCache = doInterpolate(nativeModel, basedir).getProfiles(); Profile eachExpandedProfile = expandedProfilesCache.get(i); for (ProfileActivator eachActivator : getProfileActivators(basedir)) { try { if (eachActivator.canDetermineActivation(eachExpandedProfile) && eachActivator.isActive(eachExpandedProfile)) { shouldAdd = true; break; } } catch (ProfileActivationException e) { Maven2ServerGlobals.getLogger().warn(e); } } } if (shouldAdd) { if (MavenConstants.PROFILE_FROM_POM.equals(eachRawProfile.getSource())) { activatedPom.add(eachRawProfile); } else { activatedExternal.add(eachRawProfile); } } } List<Profile> activatedProfiles = new ArrayList<Profile>(activatedPom.isEmpty() ? activeByDefault : activatedPom); activatedProfiles.addAll(activatedExternal); for (Profile each : activatedProfiles) { new DefaultProfileInjector().inject(each, nativeModel); } return new ProfileApplicationResult(Maven2ModelConverter.convertModel(nativeModel, null), collectProfilesIds(activatedProfiles)); }
public boolean canDetermineActivation( Profile profile ) { Activation activation = profile.getActivation(); return activation != null && activation.getOs() != null; }
public void testShouldNotActivateReversalOfPresentSystemProperty() throws Exception { Profile syspropActivated = new Profile(); syspropActivated.setId( "syspropActivated" ); Activation syspropActivation = new Activation(); ActivationProperty syspropProperty = new ActivationProperty(); syspropProperty.setName( "!java.version" ); syspropActivation.setProperty( syspropProperty ); syspropActivated.setActivation( syspropActivation ); Properties props = System.getProperties(); ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); profileManager.addProfile( syspropActivated ); List active = profileManager.getActiveProfiles(); assertNotNull( active ); assertEquals( 0, active.size() ); }
protected void mergeActivation( Activation target, Activation source, boolean sourceDominant, Map<Object, Object> context ) { // TODO }
private boolean isActiveByDefault( Profile profile ) { Activation activation = profile.getActivation(); return activation != null && activation.isActiveByDefault(); }
public void testShouldActivateDefaultProfile() throws Exception { Profile notActivated = new Profile(); notActivated.setId( "notActivated" ); Activation nonActivation = new Activation(); nonActivation.setJdk( "19.2" ); notActivated.setActivation( nonActivation ); Profile defaultActivated = new Profile(); defaultActivated.setId( "defaultActivated" ); Activation defaultActivation = new Activation(); defaultActivation.setActiveByDefault( true ); defaultActivated.setActivation( defaultActivation ); Properties props = System.getProperties(); ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); profileManager.addProfile( notActivated ); profileManager.addProfile( defaultActivated ); List active = profileManager.getActiveProfiles(); assertNotNull( active ); assertEquals( 1, active.size() ); assertEquals( "defaultActivated", ( (Profile) active.get( 0 ) ).getId() ); }
public void testShouldNotActivateDefaultProfile() throws Exception { Profile syspropActivated = new Profile(); syspropActivated.setId( "syspropActivated" ); Activation syspropActivation = new Activation(); ActivationProperty syspropProperty = new ActivationProperty(); syspropProperty.setName( "java.version" ); syspropActivation.setProperty( syspropProperty ); syspropActivated.setActivation( syspropActivation ); Profile defaultActivated = new Profile(); defaultActivated.setId( "defaultActivated" ); Activation defaultActivation = new Activation(); defaultActivation.setActiveByDefault( true ); defaultActivated.setActivation( defaultActivation ); Properties props = System.getProperties(); ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); profileManager.addProfile( syspropActivated ); profileManager.addProfile( defaultActivated ); List active = profileManager.getActiveProfiles(); assertNotNull( active ); assertEquals( 1, active.size() ); assertEquals( "syspropActivated", ( (Profile) active.get( 0 ) ).getId() ); }
public void testShouldOverrideAndActivateInactiveProfile() throws Exception { Profile syspropActivated = new Profile(); syspropActivated.setId( "syspropActivated" ); Activation syspropActivation = new Activation(); ActivationProperty syspropProperty = new ActivationProperty(); syspropProperty.setName( "!java.version" ); syspropActivation.setProperty( syspropProperty ); syspropActivated.setActivation( syspropActivation ); Properties props = System.getProperties(); ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); profileManager.addProfile( syspropActivated ); profileManager.explicitlyActivate( "syspropActivated" ); List active = profileManager.getActiveProfiles(); assertNotNull( active ); assertEquals( 1, active.size() ); assertEquals( "syspropActivated", ( (Profile) active.get( 0 ) ).getId() ); }
public void testShouldOverrideAndDeactivateActiveProfile() throws Exception { Profile syspropActivated = new Profile(); syspropActivated.setId( "syspropActivated" ); Activation syspropActivation = new Activation(); ActivationProperty syspropProperty = new ActivationProperty(); syspropProperty.setName( "java.version" ); syspropActivation.setProperty( syspropProperty ); syspropActivated.setActivation( syspropActivation ); Properties props = System.getProperties(); ProfileManager profileManager = new DefaultProfileManager( getContainer(), props ); profileManager.addProfile( syspropActivated ); profileManager.explicitlyDeactivate( "syspropActivated" ); List active = profileManager.getActiveProfiles(); assertNotNull( active ); assertEquals( 0, active.size() ); }
Activation replaceProfileActivation( Activation activation );
void visitProfileActivation( Activation activation );