Package org.apache.poi.openxml4j.opc

Examples of org.apache.poi.openxml4j.opc.OPCPackage.revert()


            for (SignaturePart sp : si.getSignatureParts()) {
                if (sp.validate()) {
                    result.add(sp.getSigner());
                }
            }
            pkg.revert();
            pkg.close();
            assertNotNull(result);
            assertTrue(result.isEmpty());
        }
    }
View Full Code Here


                X509Certificate signer = result.get(0);
                LOG.log(POILogger.DEBUG, "signer: " + signer.getSubjectX500Principal());
   
                boolean b = si.verifySignature();
                assertTrue("test-file: "+testFile, b);
                pkg.revert();
            } finally {
                pkg.close();
            }
        }
    }
View Full Code Here

            LOG.log(POILogger.DEBUG, "signer 1: " + signer1.getSubjectX500Principal());
            LOG.log(POILogger.DEBUG, "signer 2: " + signer2.getSubjectX500Principal());
   
            boolean b = si.verifySignature();
            assertTrue("test-file: "+testFile, b);
            pkg.revert();
        } finally {
            pkg.close();
        }
    }
   
View Full Code Here

      PackagePartName nameDerived = PackagingURIHelper
          .createPartName("/word/document.xml/image1.gif");
      pkg.createPart(name, ContentTypes.XML);
      pkg.createPart(nameDerived, ContentTypes.EXTENSION_GIF);
    } catch (InvalidOperationException e) {
      pkg.revert();
      return;
    } catch (InvalidFormatException e) {
      fail(e.getMessage());
    }
    fail("A package implementer shall neither create nor recognize a part with a"
View Full Code Here

    } catch (InvalidFormatException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    pkg.revert();
  }

  private static String extractInvalidFormatMessage(String sampleNameSuffix) {

    InputStream is = OpenXML4JTestDataSamples.openComplianceSampleStream("OPCCompliance_CoreProperties_" + sampleNameSuffix);
View Full Code Here

      // expected during successful test
      return e.getMessage();
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    pkg.revert();
    // Normally must thrown an InvalidFormatException exception.
    throw new AssertionFailedError("expected OPC compliance exception was not thrown");
  }
 
  /**
 
View Full Code Here

      throw new RuntimeException(e);
    } catch (InvalidOperationException e) {
      // expected during successful test
      assertEquals("OPC Compliance error [M4.1]: can't add another core properties part ! Use the built-in package method instead.", e.getMessage());
    }
    pkg.revert();
  }

  /**
   * Test M4.1 rule.
   */
 
View Full Code Here

      throw new RuntimeException(e);
    } catch (InvalidOperationException e) {
      // expected during successful test
      assertEquals("OPC Compliance error [M4.1]: you try to add more than one core properties relationship in the package !", e.getMessage());
    }
    pkg.revert();
  }

  /**
   * Test M4.2 rule.
   */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.