Search in sources :

Example 26 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class MetricsTest method testSummaryStatistics.

// @Test public void testMeterDerivative() {
// 
// TemporalMetrics<Integer> tm = new TemporalMetrics<>(3);
// tm.add(timeDoubler);
// tm.add(new FirstOrderDifference(tm, timeDoubler.signalID(0)));
// 
// assertEquals(3, tm.getSignals().size());
// 
// tm.update(0.0);
// tm.update(1.0);
// 
// //check the '1' column ('x')
// assertEquals(0, tm.getData(1)[0]);
// assertEquals(2, tm.getData(1)[1]);
// 
// tm.update(2.0);
// 
// 
// 
// //check the '2' column (first order diff)
// assertEquals(null, tm.getData(2)[0]);
// assertEquals(2.0, tm.getData(2)[1]);
// 
// 
// }
@Disabled
@Test
public void testSummaryStatistics() {
    TemporalMetrics tm = new TemporalMetrics(10);
    tm.add(new BasicStatistics(tm, tm.getSignalIDs()[0]));
    for (int i = 0; i < 10; i++) {
        tm.update(0.1 * i);
    }
    // noinspection OverlyComplexAnonymousInnerClass
    PrintStream sb = new PrintStream(System.out) {

        int line;

        @Override
        public void println(String x) {
            String eq = null;
            switch(line++) {
                case 0:
                    eq = "\"key\",\"key.mean\",\"key.stdev\"";
                    break;
                case 1:
                    eq = "0,0,0";
                    break;
                case 3:
                    eq = "0.2,0.1,0.1";
                    break;
            }
            if (eq != null) {
                assertEquals(eq, x);
            }
        }
    };
    tm.printCSV(sb);
}
Also used : PrintStream(java.io.PrintStream) BasicStatistics(jcog.meter.func.BasicStatistics) TemporalMetrics(jcog.meter.TemporalMetrics) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 27 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class NQuadsRDFTest method testSchema1.

@Disabled
@Test
public void testSchema1() throws Exception {
    final NAR n = NARS.tmp();
    File output = new File("/tmp/onto.nal");
    PrintStream pout = new PrintStream(new BufferedOutputStream(new FileOutputStream(output), 512 * 1024));
    n.input(NQuadsRDF.stream(n, new File(// "/tmp/all-layers.nq"
    "/home/me/Downloads/nquad")).peek(t -> {
        pout.println(t.term().toString() + t.punc());
    // t.budget(0, 0.5f);
    }));
    pout.close();
    // n.forEachActiveConcept(c -> {
    // c.print();
    // });
    n.run(1);
    // n.focus.active.clear();
    n.log();
    n.input("$0.9$ (Bacteria <-> Pharmacy)?");
    // Param.DEBUG = true;
    n.run(128);
// n.index.forEach(c -> {
// System.out.println(c);
// });
}
Also used : Param(nars.Param) Test(org.junit.jupiter.api.Test) PrintStream(java.io.PrintStream) NARS(nars.NARS) NAR(nars.NAR) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) FileOutputStream(java.io.FileOutputStream) Disabled(org.junit.jupiter.api.Disabled) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream) PrintStream(java.io.PrintStream) FileOutputStream(java.io.FileOutputStream) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream) NAR(nars.NAR) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 28 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class NQuadsRDFTest method testSchema2.

@Disabled
@Test
public void testSchema2() throws Exception {
    final NAR n = NARS.tmp();
    Param.DEBUG = true;
    for (String input : new String[] { "/home/me/d/finance/money.orig.n3", "/home/me/d/finance/finance.orig.n3" }) {
        File output = new File(input + ".nal");
        PrintStream pout = new PrintStream(new BufferedOutputStream(new FileOutputStream(output), 512 * 1024));
        NQuadsRDF.stream(n, new File(input)).peek(t -> {
            t.pri(n.priDefault(t.punc()) / 10f);
            pout.println(t + ".");
        }).forEach(x -> {
            n.input(x);
            // allow process
            n.run(1);
        });
        pout.close();
    }
    // n.forEachActiveConcept(c -> {
    // c.print();
    // });
    // n.run(512);
    /*n.concepts().forEach(Concept::print);
        n.concept($.the("Buyer")).print();*/
    n.clear();
    n.log();
    n.run(1);
    n.input("({I}-->PhysicalPerson).");
    n.run(1);
    n.input("({I}-->Seller).");
    n.run(1);
    n.input("({I}-->ExternalRisk).");
    n.run(1);
    n.input("({I}-->Service).");
    n.run(1);
    n.input("({I}-->FinancialInstrument).");
    n.run(1);
    n.input("({I}-->NonResidentCapitalOwner)!");
    n.run(1);
    n.input("isReceiverOfPhysicalValue(I,#1)!");
    n.run(1);
    n.input("--isReceiverOfPhysicalValue(#1,I)!");
    n.run(1);
    n.input("isReceiverOfObligationValue(I,#1)!");
    n.run(1);
    n.input("--isReceiverOfObligationValue(#1,I)!");
    n.run(1);
    n.input("$0.99 (I<->?x)?");
    n.run(2512);
}
Also used : Param(nars.Param) Test(org.junit.jupiter.api.Test) PrintStream(java.io.PrintStream) NARS(nars.NARS) NAR(nars.NAR) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) FileOutputStream(java.io.FileOutputStream) Disabled(org.junit.jupiter.api.Disabled) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream) PrintStream(java.io.PrintStream) FileOutputStream(java.io.FileOutputStream) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream) NAR(nars.NAR) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 29 with Disabled

use of org.junit.jupiter.api.Disabled in project narchy by automenta.

the class JavaDynamicClassLoaderTestCase method LoadClassTest.

@Disabled
@Test
public void LoadClassTest() throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InstantiationException, InvocationTargetException {
    JavaDynamicClassLoader loader = null;
    setPath(true);
    URL[] urls = getURLsFromStringArray(paths);
    loader = new JavaDynamicClassLoader(urls, this.getClass().getClassLoader());
    assertEquals(2, loader.getURLs().length);
    Class<?> cl = loader.loadClass("Counter");
    assertNotNull(cl);
    Method m = cl.getMethod("inc");
    m.setAccessible(true);
    Object obj = cl.newInstance();
    m.invoke(obj);
    Method m1 = cl.getMethod("getValue");
    m1.setAccessible(true);
    Object res_obj = m1.invoke(obj);
    int res = new Integer(res_obj.toString());
    assertEquals(1, res);
}
Also used : Method(java.lang.reflect.Method) URL(java.net.URL) JavaDynamicClassLoader(alice.util.JavaDynamicClassLoader) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 30 with Disabled

use of org.junit.jupiter.api.Disabled in project micrometer by micrometer-metrics.

the class MicrometerMetricsPublisherCommandTest method testOpenCircuit.

@Disabled
@Test
void testOpenCircuit() {
    HystrixCommandKey key = HystrixCommandKey.Factory.asKey("MicrometerCOMMAND-B");
    HystrixCommandProperties properties = new HystrixPropertiesCommandDefault(key, propertiesSetter.withCircuitBreakerForceOpen(true));
    HystrixCommandMetrics metrics = HystrixCommandMetrics.getInstance(key, groupKey, properties);
    HystrixCircuitBreaker circuitBreaker = HystrixCircuitBreaker.Factory.getInstance(key, groupKey, properties, metrics);
    SimpleMeterRegistry registry = new SimpleMeterRegistry();
    MicrometerMetricsPublisherCommand metricsPublisherCommand = new MicrometerMetricsPublisherCommand(registry, key, groupKey, metrics, circuitBreaker, properties);
    metricsPublisherCommand.initialize();
    new SuccessCommand(key).execute();
    new SuccessCommand(key).execute();
    new TimeoutCommand(key).execute();
    new FailureCommand(key).execute();
    new FailureCommand(key).execute();
    new SuccessCommand(key).execute();
    Iterable<Tag> tags = Tags.of("group", groupKey.name(), "key", key.name());
    assertExecutionMetric(registry, "short_circuited", 6.0);
    assertThat(registry.get("hystrix.execution").tags(tags).tags("event", "success").functionCounter().count()).isEqualTo(0.0);
    assertThat(registry.get("hystrix.execution").tags(tags).tags("event", "timeout").functionCounter().count()).isEqualTo(0.0);
    assertThat(registry.get("hystrix.execution").tags(tags).tags("event", "failure").functionCounter().count()).isEqualTo(0.0);
    assertThat(registry.get("hystrix.fallback").tags(tags).tags("event", "fallback_success").functionCounter().count()).isEqualTo(6.0);
    assertThat(registry.get("hystrix.circuit.breaker.open").tags(tags).gauge().value()).isEqualTo(1.0);
}
Also used : SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Tag(io.micrometer.core.instrument.Tag) HystrixPropertiesCommandDefault(com.netflix.hystrix.strategy.properties.HystrixPropertiesCommandDefault) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

Disabled (org.junit.jupiter.api.Disabled)358 Test (org.junit.jupiter.api.Test)343 URL (java.net.URL)67 ArrayList (java.util.ArrayList)23 File (java.io.File)20 List (java.util.List)15 TransactionalIntegrationTest (org.hisp.dhis.TransactionalIntegrationTest)13 CountDownLatch (java.util.concurrent.CountDownLatch)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)11 NoGood (at.ac.tuwien.kr.alpha.core.common.NoGood)10 Path (java.nio.file.Path)10 HashMap (java.util.HashMap)10 IOException (java.io.IOException)9 NAR (nars.NAR)9 BaseDataTest (org.apache.ibatis.BaseDataTest)8 Timeout (org.junit.jupiter.api.Timeout)8 Arrays (java.util.Arrays)7 ExecutorService (java.util.concurrent.ExecutorService)7 TestNAR (nars.test.TestNAR)7 URL (org.apache.dubbo.common.URL)7