Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 281787 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rwt/internal/resources/ResourceManagerImpl_Test.java (-46 / +50 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2008 Innoopract Informationssysteme GmbH.
2
 * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-14 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
10
 *     EclipseSource - ongoing development
10
 ******************************************************************************/
11
 ******************************************************************************/
11
12
package org.eclipse.rwt.internal.resources;
12
package org.eclipse.rwt.internal.resources;
13
13
14
import java.io.*;
14
import java.io.*;
Lines 50-56 Link Here
50
  private static final int TEST_PORT = 4711;
50
  private static final int TEST_PORT = 4711;
51
  private static final String TEST_SERVER = "TestCase";
51
  private static final String TEST_SERVER = "TestCase";
52
  private static final String TEST_SERVLET_PATH = "/W4TDelegate";
52
  private static final String TEST_SERVLET_PATH = "/W4TDelegate";
53
  private static final String TEST_REQUEST_URI 
53
  private static final String TEST_REQUEST_URI
54
    = TEST_CONTEXT + "/W4TDelegate?anyParam=true";
54
    = TEST_CONTEXT + "/W4TDelegate?anyParam=true";
55
  private static final String TEST_CONTEXT_URL
55
  private static final String TEST_CONTEXT_URL
56
    =   "http://"
56
    =   "http://"
Lines 84-90 Link Here
84
      + RequestParams.RESOURCE_VERSION
84
      + RequestParams.RESOURCE_VERSION
85
      + "="
85
      + "="
86
      + "1895582734";
86
      + "1895582734";
87
  
87
88
  /////////
88
  /////////
89
  // fields
89
  // fields
90
  private String webAppRoot;
90
  private String webAppRoot;
Lines 181-187 Link Here
181
  }
181
  }
182
182
183
  public void testRegistrationServletTempDir() throws Exception {
183
  public void testRegistrationServletTempDir() throws Exception {
184
    IResourceManager manager 
184
    IResourceManager manager
185
      = getManager( ResourceBase.DELIVER_BY_SERVLET_AND_TEMP_DIR );
185
      = getManager( ResourceBase.DELIVER_BY_SERVLET_AND_TEMP_DIR );
186
    clearTempFile();
186
    clearTempFile();
187
    // register only existing resources
187
    // register only existing resources
Lines 451-457 Link Here
451
      // expected
451
      // expected
452
    }
452
    }
453
  }
453
  }
454
  
454
455
  public void testGetRegisteredContent() throws Exception {
455
  public void testGetRegisteredContent() throws Exception {
456
    IResourceManager manager = getManager( ResourceBase.DELIVER_FROM_DISK );
456
    IResourceManager manager = getManager( ResourceBase.DELIVER_FROM_DISK );
457
    InputStream is = openStream( TEST_RESOURCE_2 );
457
    InputStream is = openStream( TEST_RESOURCE_2 );
Lines 462-468 Link Here
462
    content.close();
462
    content.close();
463
    assertNull( manager.getRegisteredContent( "not-there" ) );
463
    assertNull( manager.getRegisteredContent( "not-there" ) );
464
  }
464
  }
465
  
465
466
  /*
466
  /*
467
   * 280582: resource registration fails when using ImageDescriptor.createFromURL
467
   * 280582: resource registration fails when using ImageDescriptor.createFromURL
468
   * https://bugs.eclipse.org/bugs/show_bug.cgi?id=280582
468
   * https://bugs.eclipse.org/bugs/show_bug.cgi?id=280582
Lines 477-489 Link Here
477
    manager.register( name, inputStream );
477
    manager.register( name, inputStream );
478
    inputStream.close();
478
    inputStream.close();
479
    String location = manager.getLocation( name );
479
    String location = manager.getLocation( name );
480
    assertEquals( "http://TestCase:4711/test/http$1//host$1port/path$$1", 
480
    assertEquals( "http://TestCase:4711/test/http$1//host$1port/path$$1",
481
                  location );
481
                  location );
482
  }
482
  }
483
483
484
  ///////////////////
484
  ///////////////////
485
  // helping methods
485
  // helping methods
486
  
486
487
  private static int[] read( final InputStream input ) throws IOException {
487
  private static int[] read( final InputStream input ) throws IOException {
488
    int[] result = null;
488
    int[] result = null;
489
    try {
489
    try {
Lines 518-524 Link Here
518
  }
518
  }
519
519
520
  private String getResourceCopyFile( final String resourceName ) {
520
  private String getResourceCopyFile( final String resourceName ) {
521
    return webAppRoot + File.separator + resourceName;
521
    return   webAppRoot
522
           + File.separator
523
           + "resources"
524
           + File.separator
525
           + resourceName;
522
  }
526
  }
523
527
524
  private String getResourceCopyInTempFile( final String resourceName ) {
528
  private String getResourceCopyInTempFile( final String resourceName ) {
Lines 573-587 Link Here
573
      return null;
577
      return null;
574
    }
578
    }
575
579
576
    public long getDateHeader( String arg0 ) {
580
    public long getDateHeader( final String arg0 ) {
577
      return 0;
581
      return 0;
578
    }
582
    }
579
583
580
    public String getHeader( String arg0 ) {
584
    public String getHeader( final String arg0 ) {
581
      return null;
585
      return null;
582
    }
586
    }
583
587
584
    public Enumeration getHeaders( String arg0 ) {
588
    public Enumeration getHeaders( final String arg0 ) {
585
      return null;
589
      return null;
586
    }
590
    }
587
591
Lines 589-595 Link Here
589
      return null;
593
      return null;
590
    }
594
    }
591
595
592
    public int getIntHeader( String arg0 ) {
596
    public int getIntHeader( final String arg0 ) {
593
      return 0;
597
      return 0;
594
    }
598
    }
595
599
Lines 617-623 Link Here
617
      return null;
621
      return null;
618
    }
622
    }
619
623
620
    public boolean isUserInRole( String arg0 ) {
624
    public boolean isUserInRole( final String arg0 ) {
621
      return false;
625
      return false;
622
    }
626
    }
623
627
Lines 641-647 Link Here
641
      return TEST_SERVLET_PATH;
645
      return TEST_SERVLET_PATH;
642
    }
646
    }
643
647
644
    public HttpSession getSession( boolean arg0 ) {
648
    public HttpSession getSession( final boolean arg0 ) {
645
      return null;
649
      return null;
646
    }
650
    }
647
651
Lines 665-671 Link Here
665
      return false;
669
      return false;
666
    }
670
    }
667
671
668
    public Object getAttribute( String arg0 ) {
672
    public Object getAttribute( final String arg0 ) {
669
      return null;
673
      return null;
670
    }
674
    }
671
675
Lines 677-683 Link Here
677
      return null;
681
      return null;
678
    }
682
    }
679
683
680
    public void setCharacterEncoding( String arg0 )
684
    public void setCharacterEncoding( final String arg0 )
681
      throws UnsupportedEncodingException
685
      throws UnsupportedEncodingException
682
    {
686
    {
683
    }
687
    }
Lines 694-700 Link Here
694
      return null;
698
      return null;
695
    }
699
    }
696
700
697
    public String getParameter( String arg0 ) {
701
    public String getParameter( final String arg0 ) {
698
      return null;
702
      return null;
699
    }
703
    }
700
704
Lines 702-708 Link Here
702
      return null;
706
      return null;
703
    }
707
    }
704
708
705
    public String[] getParameterValues( String arg0 ) {
709
    public String[] getParameterValues( final String arg0 ) {
706
      return null;
710
      return null;
707
    }
711
    }
708
712
Lines 738-747 Link Here
738
      return null;
742
      return null;
739
    }
743
    }
740
744
741
    public void setAttribute( String arg0, Object arg1 ) {
745
    public void setAttribute( final String arg0, final Object arg1 ) {
742
    }
746
    }
743
747
744
    public void removeAttribute( String arg0 ) {
748
    public void removeAttribute( final String arg0 ) {
745
    }
749
    }
746
750
747
    public Locale getLocale() {
751
    public Locale getLocale() {
Lines 756-766 Link Here
756
      return false;
760
      return false;
757
    }
761
    }
758
762
759
    public RequestDispatcher getRequestDispatcher( String arg0 ) {
763
    public RequestDispatcher getRequestDispatcher( final String arg0 ) {
760
      return null;
764
      return null;
761
    }
765
    }
762
766
763
    public String getRealPath( String arg0 ) {
767
    public String getRealPath( final String arg0 ) {
764
      return null;
768
      return null;
765
    }
769
    }
766
770
Lines 782-841 Link Here
782
  }
786
  }
783
  private class TestResponse implements HttpServletResponse {
787
  private class TestResponse implements HttpServletResponse {
784
788
785
    public void addCookie( Cookie arg0 ) {
789
    public void addCookie( final Cookie arg0 ) {
786
    }
790
    }
787
791
788
    public boolean containsHeader( String arg0 ) {
792
    public boolean containsHeader( final String arg0 ) {
789
      return false;
793
      return false;
790
    }
794
    }
791
795
792
    public String encodeURL( String arg0 ) {
796
    public String encodeURL( final String arg0 ) {
793
      return arg0;
797
      return arg0;
794
    }
798
    }
795
799
796
    public String encodeRedirectURL( String arg0 ) {
800
    public String encodeRedirectURL( final String arg0 ) {
797
      return null;
801
      return null;
798
    }
802
    }
799
803
800
    public String encodeUrl( String arg0 ) {
804
    public String encodeUrl( final String arg0 ) {
801
      return arg0;
805
      return arg0;
802
    }
806
    }
803
807
804
    public String encodeRedirectUrl( String arg0 ) {
808
    public String encodeRedirectUrl( final String arg0 ) {
805
      return null;
809
      return null;
806
    }
810
    }
807
811
808
    public void sendError( int arg0, String arg1 ) throws IOException {
812
    public void sendError( final int arg0, final String arg1 ) throws IOException {
809
    }
813
    }
810
814
811
    public void sendError( int arg0 ) throws IOException {
815
    public void sendError( final int arg0 ) throws IOException {
812
    }
816
    }
813
817
814
    public void sendRedirect( String arg0 ) throws IOException {
818
    public void sendRedirect( final String arg0 ) throws IOException {
815
    }
819
    }
816
820
817
    public void setDateHeader( String arg0, long arg1 ) {
821
    public void setDateHeader( final String arg0, final long arg1 ) {
818
    }
822
    }
819
823
820
    public void addDateHeader( String arg0, long arg1 ) {
824
    public void addDateHeader( final String arg0, final long arg1 ) {
821
    }
825
    }
822
826
823
    public void setHeader( String arg0, String arg1 ) {
827
    public void setHeader( final String arg0, final String arg1 ) {
824
    }
828
    }
825
829
826
    public void addHeader( String arg0, String arg1 ) {
830
    public void addHeader( final String arg0, final String arg1 ) {
827
    }
831
    }
828
832
829
    public void setIntHeader( String arg0, int arg1 ) {
833
    public void setIntHeader( final String arg0, final int arg1 ) {
830
    }
834
    }
831
835
832
    public void addIntHeader( String arg0, int arg1 ) {
836
    public void addIntHeader( final String arg0, final int arg1 ) {
833
    }
837
    }
834
838
835
    public void setStatus( int arg0 ) {
839
    public void setStatus( final int arg0 ) {
836
    }
840
    }
837
841
838
    public void setStatus( int arg0, String arg1 ) {
842
    public void setStatus( final int arg0, final String arg1 ) {
839
    }
843
    }
840
844
841
    public String getCharacterEncoding() {
845
    public String getCharacterEncoding() {
Lines 850-862 Link Here
850
      return null;
854
      return null;
851
    }
855
    }
852
856
853
    public void setContentLength( int arg0 ) {
857
    public void setContentLength( final int arg0 ) {
854
    }
858
    }
855
859
856
    public void setContentType( String arg0 ) {
860
    public void setContentType( final String arg0 ) {
857
    }
861
    }
858
862
859
    public void setBufferSize( int arg0 ) {
863
    public void setBufferSize( final int arg0 ) {
860
    }
864
    }
861
865
862
    public int getBufferSize() {
866
    public int getBufferSize() {
Lines 876-882 Link Here
876
    public void reset() {
880
    public void reset() {
877
    }
881
    }
878
882
879
    public void setLocale( Locale arg0 ) {
883
    public void setLocale( final Locale arg0 ) {
880
    }
884
    }
881
885
882
    public Locale getLocale() {
886
    public Locale getLocale() {
Lines 887-893 Link Here
887
      throw new UnsupportedOperationException();
891
      throw new UnsupportedOperationException();
888
    }
892
    }
889
893
890
    public void setCharacterEncoding( String charset ) {
894
    public void setCharacterEncoding( final String charset ) {
891
      throw new UnsupportedOperationException();
895
      throw new UnsupportedOperationException();
892
    }
896
    }
893
  }
897
  }
(-)src/org/eclipse/swt/graphics/Image_Test.java (-4 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2007 Innoopract Informationssysteme GmbH.
2
 * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7-14 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
9
 *     Innoopract Informationssysteme GmbH - initial API and implementation
10
 *     EclipseSource - ongoing development
10
 ******************************************************************************/
11
 ******************************************************************************/
11
12
package org.eclipse.swt.graphics;
12
package org.eclipse.swt.graphics;
13
13
14
import java.io.*;
14
import java.io.*;
Lines 37-44 Link Here
37
//    assertEquals( 0, Image.size() );
37
//    assertEquals( 0, Image.size() );
38
    Image image1 = Graphics.getImage( RWTFixture.IMAGE1 );
38
    Image image1 = Graphics.getImage( RWTFixture.IMAGE1 );
39
    assertTrue( manager.isRegistered( RWTFixture.IMAGE1 ) );
39
    assertTrue( manager.isRegistered( RWTFixture.IMAGE1 ) );
40
    String contextPath = Fixture.CONTEXT_DIR.getPath();
40
    String contextPath = Fixture.CONTEXT_DIR.getPath() + "/resources/";
41
    assertTrue( new File( contextPath + "/" + RWTFixture.IMAGE1 ).exists() );
41
    assertTrue( new File( contextPath + RWTFixture.IMAGE1 ).exists() );
42
//    assertEquals( 1, Image.size() );
42
//    assertEquals( 1, Image.size() );
43
    Image image2 = Graphics.getImage( RWTFixture.IMAGE1 );
43
    Image image2 = Graphics.getImage( RWTFixture.IMAGE1 );
44
    assertTrue( manager.isRegistered( RWTFixture.IMAGE1 ) );
44
    assertTrue( manager.isRegistered( RWTFixture.IMAGE1 ) );
(-)src/org/eclipse/rwt/internal/resources/ResourceManagerImpl.java (+2 lines)
Lines 504-509 Link Here
504
    StringBuffer filename = new StringBuffer();
504
    StringBuffer filename = new StringBuffer();
505
    filename.append( webAppRoot );
505
    filename.append( webAppRoot );
506
    filename.append( File.separator );
506
    filename.append( File.separator );
507
    filename.append( "resources" );
508
    filename.append( File.separator );
507
    filename.append( versionedResourceName( escapeFilename( name ), version ) );
509
    filename.append( versionedResourceName( escapeFilename( name ), version ) );
508
    return new File( filename.toString() );
510
    return new File( filename.toString() );
509
  }
511
  }

Return to bug 281787