Subversion Repositories DevTools

Rev

Rev 7047 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.erggroup.buildtool.utf;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.erggroup.buildtool.ripple.BuildExclusion;
import com.erggroup.buildtool.ripple.BuildFile;
import com.erggroup.buildtool.ripple.Package;
import com.erggroup.buildtool.ripple.ReleaseManager;
import com.erggroup.buildtool.ripple.RippleEngine;
import com.erggroup.buildtool.ripple.ReleaseConfig;
import com.erggroup.buildtool.ripple.RunLevelData;
import com.erggroup.buildtool.ripple.RunLevel.BuildState;


/** Subclass and override key methods so that the test can control
 *  the data being used
 */
public class ReleaseManagerUtf extends ReleaseManager 
{
    int mAreleaseManagerUtf = 2;
    
    /** Container of persisted run levels for unit test usage
     * @attribute
     */
    public List<Integer> mPersistedRunLevelCollection = new ArrayList<Integer>();

    
    public ReleaseManagerUtf(final String connectionString, final String username, final String password)
    {
        super(connectionString, username, password);
        mUseDatabase = false;
    }

    public ReleaseManagerUtf()
    {
        super();
        mUseDatabase = false;
    }
    
    //
    //  Used by Slave
    //      Set a single run level entry
    //
    @Override
    public void querySingleRunLevel(final int rconId, String hostname, char daemonMode) throws SQLException, Exception
    {
        mRunLevelCollection.clear();
        RunLevelData runLevel = new RunLevelData(rconId, BuildState.DB_ACTIVE, 'S', 1);
        mRunLevelCollection.add(runLevel);
    }

    //
    //  Used by Master
    //
    @Override
    public void queryRunLevel(final int rtag_id) throws SQLException, Exception
    {
        // Nothing to do here
    }
    
    // Used by Master and Slave
    @Override
    public int queryMasterCount(final int rtag_id) throws SQLException, Exception
    {
        return 1;
    }

    @Override
    public void queryReleaseConfig(final int rtag_id) throws SQLException, Exception
    {
        mReleaseConfigCollection.resetData();

        ReleaseConfig releaseConfig = new ReleaseConfig(1,1,'M', "LinuxHost","BuildLinux", "linux_i386", "Linux");
        mReleaseConfigCollection.add(releaseConfig);

        releaseConfig = new ReleaseConfig(1,2,'S', "SparcHost","BuildSparc", "sparc", "Solaris");
        mReleaseConfigCollection.add(releaseConfig);

        releaseConfig = new ReleaseConfig(1,3,'S', "Sparc10X86Host","BuildSparc10X86", "solaris10_x86", "Solaris");
        mReleaseConfigCollection.add(releaseConfig);

    }

    @Override
    public String queryMailServer() throws SQLException, Exception
    {
        return "dummyEmailServer.vixtechnology.com";
    }

    @Override
    public String queryMailSender() throws SQLException, Exception
    {
        return "dummyEmailSender.vixtechnology.com";
    }

    @Override
    public String queryGlobalAddresses() throws SQLException, Exception
    {
        return "dummyEmailSender.vixtechnology.com";
    }

    @Override
    public String queryBaselineName(int baseline) throws SQLException, Exception
    {
        return "TIMBUKTU (TIM) > R7";
    }
    
    @Override
    public List<String> queryProjectEmail(int baseline) throws SQLException
    {
        ArrayList<String> emailCollection = new ArrayList<String>();
        emailCollection.add("global1@vixtechnology.com");
        emailCollection.add("global2@vixtechnology.com");
        emailCollection.add("global1@vixtechnology.com");
        return emailCollection;
    }

    @Override
    public void connect()
    {
        // Nothing to do here
    }

    @Override
    public void disconnect()
    {
        // Nothing to do here
    }

    @Override
    public void queryBuildExclusions(List<BuildExclusion> buildExclusionCollection, int baseline)
            throws SQLException, Exception
    {
        //  Nothing to do here
    }

    @Override
    public void queryPackageVersions(RippleEngine rippleEngine, ArrayList<Package> packageCollection,
            int baseline) throws SQLException, Exception
    {
        // Nothing to do here
    }
    
    @Override
    public void queryWips(RippleEngine rippleEngine, ArrayList<Package> packageCollection, int baseline) throws SQLException, Exception
    {
    }
    
    @Override
    public void queryTest(RippleEngine rippleEngine, ArrayList<Package> packageCollection, int baseline) throws SQLException, Exception
    {
    }
    
    @Override
    public void queryRipples(RippleEngine rippleEngine, ArrayList<Package> packageCollection, int baseline) throws SQLException, Exception
    {
    }
    
    @Override
    public int queryRtagIdForSbom(int sbomId) throws SQLException
    {
        return 123456;
    }
    
    @Override
    public void updateCurrentRunLevel(final int rconId, final int runLevel) throws SQLException, Exception
    {
        Integer i = Integer.valueOf(runLevel);
        mPersistedRunLevelCollection.add(i);
    }
    
    @Override
    public long currentTimeMillis()
    {
        return 123456789;
    }
    
    @Override
    public String getMajorVersionNumber()
    {
        return "11";
    }
    
    @Override
    public void publishBuildFile(int rtag_id, BuildFile buildFile) throws SQLException, Exception
    {
    }
}