@Test public void testUpdateProjectVersionProperty() throws Exception { Project pP = getProject(); ManipulationSession session = createUpdateSession(); assertNotSame( updateProperties( session, pP, false, "project.version", "5.0.4.Final-redhat-1" ), PropertiesUtils.PropertyUpdate.FOUND ); }
public static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict, String key, String newValue ) throws ManipulationException { final String resolvedValue = PropertyResolver.resolveProperties( session, project.getInheritedList(), "${" + key + '}' ); logger.debug( "Fully resolvedValue is {} for {} ", resolvedValue, key ); if ( "project.version".equals( key ) ) { logger.debug( "Not updating key {} with {} ", key, newValue ); return PropertyUpdate.IGNORE; } for ( final Project p : project.getReverseInheritedList() ) { if ( p.getModel().getProperties().containsKey( key ) ) { logger.trace( "Searching properties of {} ", p ); return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, p.getModel().getProperties() ); } else { for ( Profile pr : ProfileUtils.getProfiles( session, p.getModel() ) ) { logger.trace( "Searching properties of profile {} within project {} ", pr.getId(), p ); if ( pr.getProperties().containsKey( key ) ) { return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, pr.getProperties() ); } } } } return PropertyUpdate.NOTFOUND; }
PropertiesUtils { public static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict, String key, String newValue ) throws ManipulationException { final String resolvedValue = PropertyResolver.resolveProperties( session, project.getInheritedList(), "${" + key + '}' ); logger.debug( "Fully resolvedValue is {} for {} ", resolvedValue, key ); if ( "project.version".equals( key ) ) { logger.debug( "Not updating key {} with {} ", key, newValue ); return PropertyUpdate.IGNORE; } for ( final Project p : project.getReverseInheritedList() ) { if ( p.getModel().getProperties().containsKey( key ) ) { logger.trace( "Searching properties of {} ", p ); return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, p.getModel().getProperties() ); } else { for ( Profile pr : ProfileUtils.getProfiles( session, p.getModel() ) ) { logger.trace( "Searching properties of profile {} within project {} ", pr.getId(), p ); if ( pr.getProperties().containsKey( key ) ) { return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, pr.getProperties() ); } } } } return PropertyUpdate.NOTFOUND; } }
PropertiesUtils { public static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict, String key, String newValue ) throws ManipulationException { final String resolvedValue = PropertyResolver.resolveProperties( session, project.getInheritedList(), "${" + key + '}' ); logger.debug( "Fully resolvedValue is {} for {} ", resolvedValue, key ); if ( "project.version".equals( key ) ) { logger.debug( "Not updating key {} with {} ", key, newValue ); return PropertyUpdate.IGNORE; } for ( final Project p : project.getReverseInheritedList() ) { if ( p.getModel().getProperties().containsKey( key ) ) { logger.trace( "Searching properties of {} ", p ); return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, p.getModel().getProperties() ); } else { for ( Profile pr : ProfileUtils.getProfiles( session, p.getModel() ) ) { logger.trace( "Searching properties of profile {} within project {} ", pr.getId(), p ); if ( pr.getProperties().containsKey( key ) ) { return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, pr.getProperties() ); } } } } return PropertyUpdate.NOTFOUND; } private  PropertiesUtils(); }
PropertiesUtils { public static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict, String key, String newValue ) throws ManipulationException { final String resolvedValue = PropertyResolver.resolveProperties( session, project.getInheritedList(), "${" + key + '}' ); logger.debug( "Fully resolvedValue is {} for {} ", resolvedValue, key ); if ( "project.version".equals( key ) ) { logger.debug( "Not updating key {} with {} ", key, newValue ); return PropertyUpdate.IGNORE; } for ( final Project p : project.getReverseInheritedList() ) { if ( p.getModel().getProperties().containsKey( key ) ) { logger.trace( "Searching properties of {} ", p ); return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, p.getModel().getProperties() ); } else { for ( Profile pr : ProfileUtils.getProfiles( session, p.getModel() ) ) { logger.trace( "Searching properties of profile {} within project {} ", pr.getId(), p ); if ( pr.getProperties().containsKey( key ) ) { return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, pr.getProperties() ); } } } } return PropertyUpdate.NOTFOUND; } private  PropertiesUtils(); static Map<String, String> getPropertiesByPrefix( final Properties properties, final String prefix ); static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict,
                                                   String key, String newValue ); static String getSuffix( ManipulationSession session ); static boolean checkStrictValue( ManipulationSession session, String oldValue, String newValue ); static boolean cacheProperty( Project project, CommonState state, Map<Project, Map<String, PropertyMapper>> versionPropertyUpdateMap,
                                         String oldVersion, String newVersion, Object originalType, boolean force ); static String extractPropertyName( String version ); static void verifyPropertyMapping( CommonState cState, Project project, Map<Project, Map<String, PropertyMapper>> versionPropertyMap,
                                              ProjectVersionRef pvr, String version ); static void handleConfigPrecedence( Properties userProperties, Properties config ); }
PropertiesUtils { public static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict, String key, String newValue ) throws ManipulationException { final String resolvedValue = PropertyResolver.resolveProperties( session, project.getInheritedList(), "${" + key + '}' ); logger.debug( "Fully resolvedValue is {} for {} ", resolvedValue, key ); if ( "project.version".equals( key ) ) { logger.debug( "Not updating key {} with {} ", key, newValue ); return PropertyUpdate.IGNORE; } for ( final Project p : project.getReverseInheritedList() ) { if ( p.getModel().getProperties().containsKey( key ) ) { logger.trace( "Searching properties of {} ", p ); return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, p.getModel().getProperties() ); } else { for ( Profile pr : ProfileUtils.getProfiles( session, p.getModel() ) ) { logger.trace( "Searching properties of profile {} within project {} ", pr.getId(), p ); if ( pr.getProperties().containsKey( key ) ) { return internalUpdateProperty( session, p, ignoreStrict, key, newValue, resolvedValue, pr.getProperties() ); } } } } return PropertyUpdate.NOTFOUND; } private  PropertiesUtils(); static Map<String, String> getPropertiesByPrefix( final Properties properties, final String prefix ); static PropertyUpdate updateProperties( ManipulationSession session, Project project, boolean ignoreStrict,
                                                   String key, String newValue ); static String getSuffix( ManipulationSession session ); static boolean checkStrictValue( ManipulationSession session, String oldValue, String newValue ); static boolean cacheProperty( Project project, CommonState state, Map<Project, Map<String, PropertyMapper>> versionPropertyUpdateMap,
                                         String oldVersion, String newVersion, Object originalType, boolean force ); static String extractPropertyName( String version ); static void verifyPropertyMapping( CommonState cState, Project project, Map<Project, Map<String, PropertyMapper>> versionPropertyMap,
                                              ProjectVersionRef pvr, String version ); static void handleConfigPrecedence( Properties userProperties, Properties config );  }