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);
}
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();
}
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();
}
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;
}
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();
}
}
Aggregations