Search in sources :

Example 66 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class GridLongList method toString.

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
    SB b = new SB("[");
    for (int i = 0; i < idx; i++) {
        if (i != 0)
            b.a(',');
        b.a(arr[i]);
    }
    b.a(']');
    return S.toString(GridLongList.class, this, "arr", b);
}
Also used : SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 67 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class ConfigVariationsFactory method getIgniteConfigurationDescription.

/**
 * @return Description.
 */
public String getIgniteConfigurationDescription() {
    if (igniteParams == null)
        return "";
    SB sb = new SB("[");
    for (int i = 0; i < igniteCfgVariation.length; i++) {
        int var = igniteCfgVariation[i];
        ConfigParameter<IgniteConfiguration> cfgC = igniteParams[i][var];
        if (cfgC != null) {
            sb.a(cfgC.name());
            if (i + 1 < igniteCfgVariation.length)
                sb.a(", ");
        }
    }
    sb.a("]");
    return sb.toString();
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 68 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class ConfigVariationsFactory method getCacheConfigurationDescription.

/**
 * @return Description.
 */
public String getCacheConfigurationDescription() {
    if (cacheCfgVariation == null)
        return "";
    SB sb = new SB("[");
    for (int i = 0; i < cacheCfgVariation.length; i++) {
        int var = cacheCfgVariation[i];
        ConfigParameter cfgC = cacheParams[i][var];
        if (cfgC != null) {
            sb.a(cfgC.name());
            if (i + 1 < cacheCfgVariation.length)
                sb.a(", ");
        }
    }
    if (backups > 0)
        sb.a(", backups=").a(backups);
    sb.a("]");
    return sb.toString();
}
Also used : SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 69 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class GridStringBuilderFactorySelfTest method testStringBuilderFactory.

/**
 * Tests string builder factory.
 */
public void testStringBuilderFactory() {
    SB b1 = GridStringBuilderFactory.acquire();
    assert b1.length() == 0;
    b1.a("B1 Test String");
    SB b2 = GridStringBuilderFactory.acquire();
    assert b2.length() == 0;
    assert b1 != b2;
    b1.a("B2 Test String");
    assert !b1.toString().equals(b2.toString());
    GridStringBuilderFactory.release(b2);
    GridStringBuilderFactory.release(b1);
    assert b1.length() == 0;
    assert b2.length() == 0;
    SB b3 = GridStringBuilderFactory.acquire();
    assert b1 == b3;
    assert b3.length() == 0;
    b3.a("B3 Test String");
    GridStringBuilderFactory.release(b3);
    assert b3.length() == 0;
}
Also used : SB(org.apache.ignite.internal.util.typedef.internal.SB)

Example 70 with SB

use of org.apache.ignite.internal.util.typedef.internal.SB in project ignite by apache.

the class IgniteCrossCachesJoinsQueryTest method checkAllCacheCombinations.

/**
 * @param idx Index flag.
 * @param cacheList Caches.
 * @throws Exception If failed.
 */
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
private void checkAllCacheCombinations(boolean idx, List<List<TestCache>> cacheList) throws Exception {
    data = prepareData();
    initCacheAndDbData();
    try {
        Map<TestConfig, Throwable> errors = new LinkedHashMap<>();
        List<TestConfig> success = new ArrayList<>();
        int cfgIdx = 0;
        for (List<TestCache> caches : cacheList) {
            assert caches.size() == 3 : caches;
            TestCache personCache = caches.get(0);
            TestCache accCache = caches.get(1);
            TestCache orgCache = caches.get(2);
            try {
                check(idx, personCache, accCache, orgCache);
                success.add(new TestConfig(cfgIdx, cache, personCache, accCache, orgCache, ""));
            } catch (Throwable e) {
                error("", e);
                errors.put(new TestConfig(cfgIdx, cache, personCache, accCache, orgCache, qry), e);
            }
            cfgIdx++;
        }
        if (!errors.isEmpty()) {
            int total = cacheList.size();
            SB sb = new SB("Test failed for the following " + errors.size() + " combination(s) (" + total + " total):\n");
            for (Map.Entry<TestConfig, Throwable> e : errors.entrySet()) sb.a(e.getKey()).a(", error=").a(e.getValue()).a("\n");
            sb.a("Successfully finished combinations:\n");
            for (TestConfig t : success) sb.a(t).a("\n");
            sb.a("The following data has beed used for test:\n " + data);
            fail(sb.toString());
        }
    } finally {
        for (String cacheName : new String[] { PERSON_CACHE_NAME, ACC_CACHE_NAME, ORG_CACHE_NAME }) ignite(0).destroyCache(cacheName);
        Statement st = conn.createStatement();
        st.execute("drop table \"" + ACC_CACHE_NAME + "\".Account");
        st.execute("drop table \"" + PERSON_CACHE_NAME + "\".Person");
        st.execute("drop table \"" + ORG_CACHE_NAME + "\".Organization");
        conn.commit();
        st.close();
    }
}
Also used : PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) SB(org.apache.ignite.internal.util.typedef.internal.SB) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

SB (org.apache.ignite.internal.util.typedef.internal.SB)70 Map (java.util.Map)10 HashMap (java.util.HashMap)7 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 LinkedHashMap (java.util.LinkedHashMap)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 GridStringBuilder (org.apache.ignite.internal.util.GridStringBuilder)4 InputStreamReader (java.io.InputStreamReader)3 SqlFieldsQuery (org.apache.ignite.cache.query.SqlFieldsQuery)3 IgfsLogger (org.apache.ignite.internal.igfs.common.IgfsLogger)3 InputStream (java.io.InputStream)2 InterruptedIOException (java.io.InterruptedIOException)2 LineNumberReader (java.io.LineNumberReader)2 URL (java.net.URL)2 URLConnection (java.net.URLConnection)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 UUID (java.util.UUID)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2