Search in sources :

Example 1 with PruneOption

use of org.aion.zero.impl.config.CfgDb.PruneOption in project aion by aionnetwork.

the class EditCliTest method paramsForTestConverter.

public Object paramsForTestConverter() {
    List<Object> params = new ArrayList<>();
    EditCli.EnabledConverter enabledConverter = new EditCli.EnabledConverter();
    EditCli.DBVendorConverter dbVendorConverter = new EditCli.DBVendorConverter();
    EditCli.DBPruneOptionConverter dbPruneOptionConverter = new EditCli.DBPruneOptionConverter();
    EditCli.PortNumberConverter portNumberConverter = new EditCli.PortNumberConverter();
    EditCli.LogConverter logConverter = new EditCli.LogConverter();
    params.add(new Object[] { "on", enabledConverter, true });
    params.add(new Object[] { "off", enabledConverter, false });
    for (DBVendor vendor : DBVendor.values()) {
        if (!vendor.equals(DBVendor.UNKNOWN)) {
            params.add(new Object[] { vendor.toString().toUpperCase(), dbVendorConverter, vendor });
            params.add(new Object[] { vendor.toString().toLowerCase(), dbVendorConverter, vendor });
        }
    }
    for (CfgDb.PruneOption pruneOption : CfgDb.PruneOption.values()) {
        params.add(new Object[] { pruneOption.toString().toUpperCase(), dbPruneOptionConverter, pruneOption });
        params.add(new Object[] { pruneOption.toString().toLowerCase(), dbPruneOptionConverter, pruneOption });
    }
    for (LogEnum logEnum : LogEnum.values()) {
        for (LogLevel logLevel : LogLevel.values()) {
            params.add(new Object[] { logEnum.toString() + "=" + logLevel.toString(), logConverter, new Object[] { logEnum, logLevel } });
        }
    }
    int[] ports = { 0x1, 0xF, 0xFF, 0xFFF, 0xFFFF };
    for (Integer port : ports) {
        params.add(new Object[] { port.toString(), portNumberConverter, port });
    }
    return params;
}
Also used : PruneOption(org.aion.zero.impl.config.CfgDb.PruneOption) CfgDb(org.aion.zero.impl.config.CfgDb) ArrayList(java.util.ArrayList) DBVendor(org.aion.db.impl.DBVendor) LogLevel(org.aion.log.LogLevel) LogEnum(org.aion.log.LogEnum)

Example 2 with PruneOption

use of org.aion.zero.impl.config.CfgDb.PruneOption in project aion by aionnetwork.

the class EditCliTest method paramsForTestConverterValidation.

public Object paramsForTestConverterValidation() {
    List<Object[]> params = new ArrayList<>();
    EditCli.EnabledConverter enabledConverter = new EditCli.EnabledConverter();
    EditCli.DBVendorConverter dbVendorConverter = new EditCli.DBVendorConverter();
    EditCli.DBPruneOptionConverter dbPruneOptionConverter = new EditCli.DBPruneOptionConverter();
    EditCli.PortNumberConverter portNumberConverter = new EditCli.PortNumberConverter();
    EditCli.LogConverter logConverter = new EditCli.LogConverter();
    params.add(new Object[] { "onn", enabledConverter });
    params.add(new Object[] { "offf", enabledConverter });
    params.add(new Object[] { "on".toUpperCase(), enabledConverter });
    params.add(new Object[] { "off".toUpperCase(), enabledConverter });
    params.add(new Object[] { "".toUpperCase(), enabledConverter });
    for (DBVendor vendor : DBVendor.values()) {
        params.add(new Object[] { vendor + "1", dbVendorConverter });
    }
    params.add(new Object[] { "", dbVendorConverter });
    for (CfgDb.PruneOption pruneOption : CfgDb.PruneOption.values()) {
        params.add(new Object[] { pruneOption.toString().toUpperCase() + "1", dbPruneOptionConverter });
        params.add(new Object[] { pruneOption.toString().toLowerCase() + "1", dbPruneOptionConverter });
    }
    params.add(new Object[] { "", dbPruneOptionConverter });
    for (LogEnum logEnum : LogEnum.values()) {
        for (LogLevel logLevel : LogLevel.values()) {
            params.add(new Object[] { logEnum.toString() + "-" + logLevel.toString(), logConverter });
            params.add(new Object[] { logEnum.toString() + "=" + logLevel.toString() + "1", logConverter });
            params.add(new Object[] { logEnum.toString() + "1" + "=" + logLevel.toString() + "1", logConverter });
            params.add(new Object[] { logEnum.toString() + "1" + "=" + logLevel.toString(), logConverter });
        }
    }
    params.add(new Object[] { "", logConverter });
    int[] ports = { 0x0, 0xFFFF + 1 };
    for (Integer port : ports) {
        params.add(new Object[] { port.toString(), portNumberConverter });
    }
    params.add(new Object[] { "", portNumberConverter });
    return params;
}
Also used : PruneOption(org.aion.zero.impl.config.CfgDb.PruneOption) CfgDb(org.aion.zero.impl.config.CfgDb) ArrayList(java.util.ArrayList) DBVendor(org.aion.db.impl.DBVendor) LogLevel(org.aion.log.LogLevel) LogEnum(org.aion.log.LogEnum)

Aggregations

ArrayList (java.util.ArrayList)2 DBVendor (org.aion.db.impl.DBVendor)2 LogEnum (org.aion.log.LogEnum)2 LogLevel (org.aion.log.LogLevel)2 CfgDb (org.aion.zero.impl.config.CfgDb)2 PruneOption (org.aion.zero.impl.config.CfgDb.PruneOption)2