Example usage for java.lang LinkageError LinkageError

List of usage examples for java.lang LinkageError LinkageError

Introduction

In this page you can find the example usage for java.lang LinkageError LinkageError.

Prototype

public LinkageError(String s) 

Source Link

Document

Constructs a LinkageError with the specified detail message.

Usage

From source file:Main.java

private static final Field getFieldOrDie(Class<?> clazz, String fieldName) {
    try {/* ww  w. j  a v a2  s .c  o m*/
        Field field = clazz.getDeclaredField(fieldName);
        field.setAccessible(true);
        return field;
    } catch (ReflectiveOperationException e) {
        throw new LinkageError(e.getMessage());
    }
}

From source file:com.thoughtworks.go.server.service.ScheduleServiceIntegrationTest.java

@Test
public void shouldTriggerNextStageOfPipelineEvenIfOneOfTheListenersFailWithAnError() throws Exception {
    String pipelineName = UUID.randomUUID().toString();
    String firstStage = "firstStage";
    String secondStage = "secondStage";
    PipelineConfig pipelineConfig = configHelper.addPipeline(
            PipelineConfigMother.createPipelineConfigWithStages(pipelineName, firstStage, secondStage));
    Pipeline pipeline = dbHelper.schedulePipeline(pipelineConfig, forceBuild(pipelineConfig),
            new TimeProvider());
    stageService.addStageStatusListener(new StageStatusListener() {
        @Override//from  w  w w.  j  ava  2  s .  c o  m
        public void stageStatusChanged(Stage stage) {
            throw new LinkageError("some nasty linkage error");
        }
    });
    JobInstance job = pipeline.getFirstStage().getFirstJob();
    JobIdentifier jobIdentifier = job.getIdentifier();
    scheduleService.jobCompleting(jobIdentifier, JobResult.Passed, job.getAgentUuid());

    scheduleService.updateJobStatus(jobIdentifier, JobState.Completed);
    assertThat(stageService.findLatestStage(pipelineName, secondStage), is(notNullValue()));
}

From source file:org.apache.metron.stellar.dsl.functions.resolver.ClasspathFunctionResolverTest.java

@Test
public void testInvalidStellarClass() throws Exception {
    StellarFunction goodFunc = mock(StellarFunction.class);
    StellarFunction badFunc = mock(StellarFunction.class);
    ClasspathFunctionResolver resolver = new ClasspathFunctionResolver() {
        @Override//  ww  w .jav a 2 s . c  o m
        protected Iterable<Class<?>> getStellarClasses(ClassLoader cl) {
            return ImmutableList.of(goodFunc.getClass(), badFunc.getClass());
        }

        @Override
        protected boolean includeClass(Class<?> c, FilterBuilder filterBuilder) {
            if (c != goodFunc.getClass()) {
                throw new LinkageError("failed!");
            }
            return true;
        }
    };
    Set<Class<? extends StellarFunction>> funcs = resolver.resolvables();
    Assert.assertEquals(1, funcs.size());
    Assert.assertEquals(goodFunc.getClass(), Iterables.getFirst(funcs, null));
}