コード例 #1
0
ファイル: AnnotationsAttribute.java プロジェクト: masonmei/mx
 /** Copies this attribute and returns a new copy. */
 public AttributeInfo copy(ConstPool newCp, Map classnames) {
   Copier copier = new Copier(info, constPool, newCp, classnames);
   try {
     copier.annotationArray();
     return new AnnotationsAttribute(newCp, getName(), copier.close());
   } catch (Exception e) {
     throw new RuntimeException(e);
   }
 }
コード例 #2
0
  @Override
  public Object copy(Object object) {

    for (Copier copier : COPIERS) {

      try {
        return copier.copy(object);
      } catch (Exception ignore) {
        continue;
      }
    }

    throw new IllegalStateException(
        "Can't copy object of type "
            + object.getClass()
            + ". No copier appeared to be capable of copying it.");
  }
コード例 #3
0
  @Test
  public void testParseComObjetosInner() {

    InnerObjectSource de = new InnerObjectSource(new NoAnnotationSource("BB", "123321"));
    DestinyInnerObject para = copier.from(de).doCopy();

    assertEquals("BB", para.getObject().getFirst());
  }
コード例 #4
0
  @Test
  public void testParseComObjetosDeInnerEParaOuter() {

    InnerObjectMultipleObjectFieldsToFields de =
        new InnerObjectMultipleObjectFieldsToFields(new NoAnnotationSource("BB", "123321"));
    Destiny para = copier.from(de).doCopy();
    assertEquals("BB", para.getFirst());
    assertEquals("123321", para.getSecond());
  }
コード例 #5
0
  @Test
  public void testParseComObjetosInnerEVariosAtributos() {

    InnerObjectMultipleObjectFieldsToObjectFields de =
        new InnerObjectMultipleObjectFieldsToObjectFields(new NoAnnotationSource("BB", "123321"));
    DestinyInnerObject para = copier.from(de).doCopy();
    assertEquals("BB", para.getObject().getFirst());
    assertEquals("123321", para.getObject().getSecond());
  }
コード例 #6
0
  @Test
  public void testParseComObjetosParaInnerEDeOuter() {

    InnerObjectMultipleFieldsToObjectFields de =
        new InnerObjectMultipleFieldsToObjectFields("BB", "123321");
    DestinyInnerObject para = copier.from(de).doCopy();
    assertEquals("BB", para.getObject().getFirst());
    assertEquals("123321", para.getObject().getSecond());
  }
コード例 #7
0
  @Test
  public void testParseAtributosComAnnotacaoParaPreenchido() {

    InvertedFieldsSource de = new InvertedFieldsSource("BB", "123321", "M");
    Destiny para = copier.from(de).doCopy();

    assertEquals("123321", para.getFirst());
    assertEquals("BB", para.getSecond());
    assertEquals(null, para.getOther());
  }
コード例 #8
0
  @Test
  public void testParseAtributosComAnnotacaoDefault() {

    FieldAnnotationSource de = new FieldAnnotationSource("BB", "123321", "M");
    Destiny para = copier.from(de).doCopy();

    assertEquals("BB", para.getFirst());
    assertEquals("123321", para.getSecond());
    assertEquals(null, para.getOther());
  }
コード例 #9
0
  @Test
  public void testParseAtributosComMesmoNome() {

    ClassAnnotationSource de = new ClassAnnotationSource("BB", "123321", "M");
    Destiny para = copier.from(de).doCopy();

    assertEquals("BB", para.getFirst());
    assertEquals("123321", para.getSecond());
    assertEquals(null, para.getOther());
  }
コード例 #10
0
  @Test
  public void testParseObjetoSimples() {

    ClassAnnotationSource de = new ClassAnnotationSource("BB", "123321", null);
    ClassAnnotationSource para = copier.from(de).doCopy(ClassAnnotationSource.class);

    assertEquals("BB", para.getFirst());
    assertEquals("123321", para.getSecond());
    assertEquals(null, para.getThird());
  }
コード例 #11
0
ファイル: ChannelRunner.java プロジェクト: Journey/hudson-2.x
    public void stop(Channel channel) throws Exception {
      channel.close();
      channel.join(10 * 1000);

      //            System.out.println("north completed");

      executor.shutdown();

      copier.join();
      int r = proc.waitFor();
      //            System.out.println("south completed");

      Assert.assertEquals("exit code should have been 0", 0, r);
    }
コード例 #12
0
ファイル: ChannelRunner.java プロジェクト: Journey/hudson-2.x
    public Channel start() throws Exception {
      System.out.println("forking a new process");
      // proc = Runtime.getRuntime().exec("java -Xdebug
      // -Xrunjdwp:transport=dt_socket,server=y,address=8000 hudson.remoting.Launcher");

      System.out.println(getClasspath());
      proc =
          Runtime.getRuntime()
              .exec(new String[] {"java", "-cp", getClasspath(), "hudson.remoting.Launcher"});

      copier = new Copier("copier", proc.getErrorStream(), System.out);
      copier.start();

      executor = Executors.newCachedThreadPool();
      OutputStream out = proc.getOutputStream();
      if (RECORD_OUTPUT) {
        File f = File.createTempFile("remoting", ".log");
        System.out.println("Recording to " + f);
        out = new TeeOutputStream(out, new FileOutputStream(f));
      }
      return new Channel("north", executor, proc.getInputStream(), out);
    }
コード例 #13
0
 @Test(expected = RuntimeException.class)
 public void testParseSemAnnotacao() {
   copier.from(new NoAnnotationSource("BB", "123321")).doCopy();
 }
コード例 #14
0
 @Test(expected = IllegalArgumentException.class)
 public void whenPassingNullToFromAnnotedObject() {
   copier.from(null);
 }
コード例 #15
0
 @Override
 public CopyResponse copy(final CopyRequest request) throws Exception {
   return Copier.copy(request);
 }