コード例 #1
0
 @Test
 public void catagorizeApache11OnlyByURL() {
   License cl = new License();
   cl.setUrl("http://www.apache.org/licenses/LICENSE-1.1");
   Assert.assertFalse(result.isValid(cl));
   Assert.assertFalse(result.isInvalid(cl));
   Assert.assertTrue(result.isWarning(cl));
   Assert.assertFalse(result.isUnknown(cl));
 }
コード例 #2
0
 @Test
 public void catagorizeGPL20() {
   License cl = new License();
   cl.setName("GNU General Public License, version 3");
   cl.setUrl("http://www.gnu.org/licenses/gpl-3.0.txt");
   Assert.assertFalse(result.isValid(cl));
   Assert.assertTrue(result.isInvalid(cl));
   Assert.assertFalse(result.isWarning(cl));
   Assert.assertFalse(result.isUnknown(cl));
 }
コード例 #3
0
 @Test
 public void categorizeApache20WithWrongURL() {
   License cl = new License();
   cl.setName("The Apache Software License, Version 2.0");
   cl.setUrl("/LICENSE.txt");
   Assert.assertTrue(result.isValid(cl));
   Assert.assertFalse(result.isInvalid(cl));
   Assert.assertFalse(result.isWarning(cl));
   Assert.assertFalse(result.isUnknown(cl));
 }
コード例 #4
0
 @Test
 public void catagorizeApache20() {
   License cl = new License();
   cl.setName("Apache Software License, Version 2.0");
   cl.setUrl("http://apache.org/licenses/LICENSE-2.0.txt");
   Assert.assertTrue(result.isValid(cl));
   Assert.assertFalse(result.isInvalid(cl));
   Assert.assertFalse(result.isWarning(cl));
   Assert.assertFalse(result.isUnknown(cl));
 }
コード例 #5
0
 @Test
 public void catagorizeCPLV10() {
   License cl = new License();
   cl.setName("Common Public License Version 1.0");
   cl.setUrl("http://www.opensource.org/licenses/cpl1.0.txt");
   Assert.assertTrue(result.isValid(cl));
   Assert.assertFalse(result.isInvalid(cl));
   Assert.assertFalse(result.isWarning(cl));
   Assert.assertFalse(result.isUnknown(cl));
 }
コード例 #6
0
  @Test
  public void catagorizeArtifactValidWithTwoLicensesNameAndURL() {
    License cl1 = new License();
    cl1.setName("Test License");
    cl1.setUrl(null);

    License cl2 = new License();
    cl2.setName(null);
    cl2.setUrl("http://www.testlicense.org/License-1.0.txt");

    ArrayList<License> licenses = new ArrayList<License>();
    licenses.add(cl1);
    licenses.add(cl2);

    Assert.assertTrue(result.isValid(licenses));
    Assert.assertFalse(result.isInvalid(licenses));
    Assert.assertFalse(result.isWarning(licenses));
    Assert.assertFalse(result.isUnknown(licenses));
  }
コード例 #7
0
  @Test
  public void catagorizeArtifactValidWithTwoLicensesNames() {
    License cl1 = new License();
    cl1.setName("Test License");
    cl1.setUrl(null);

    License cl2 = new License();
    cl2.setName("Test License, Version 1.0");
    cl2.setUrl(null);

    ArrayList<License> licenses = new ArrayList<License>();
    licenses.add(cl1);
    licenses.add(cl2);

    Assert.assertTrue(result.isValid(licenses));
    Assert.assertFalse(result.isInvalid(licenses));
    Assert.assertFalse(result.isWarning(licenses));
    Assert.assertFalse(result.isUnknown(licenses));
  }
コード例 #8
0
 @Test
 public void catagorizeUnknown() {
   License cl = new License();
   cl.setName("Unknown License");
   cl.setUrl(null);
   Assert.assertFalse(result.isValid(cl));
   Assert.assertFalse(result.isInvalid(cl));
   Assert.assertFalse(result.isWarning(cl));
   Assert.assertTrue(result.isUnknown(cl));
 }
コード例 #9
0
  @Test
  public void catagorizeArtifactWithTwoLicensesFromNoCategory() {
    // whereas the second one is in the "Valid" category
    License cl1 = new License();
    cl1.setName("Unknown License V1.0");
    cl1.setUrl(null);

    License cl2 = new License();
    cl2.setName(null);
    cl2.setUrl("http://www.the-unknown-license.com/license-v.1.0.html");

    ArrayList<License> licenses = new ArrayList<License>();
    licenses.add(cl1);
    licenses.add(cl2);

    Assert.assertFalse(result.isValid(licenses));
    Assert.assertFalse(result.isInvalid(licenses));
    Assert.assertFalse(result.isWarning(licenses));
    Assert.assertTrue(result.isUnknown(licenses));
  }
コード例 #10
0
  @Test
  public void catagorizeArtifactWithTwoLicensesFromTwoCategories() {
    // The first license is in the "Invalid" category
    // whereas the second one is in the "Valid" category
    License cl1 = new License();
    cl1.setName("GNU General Public License, version 2");
    cl1.setUrl(null);

    License cl2 = new License();
    cl2.setName(null);
    cl2.setUrl("http://www.testlicense.org/License-1.0.txt");

    ArrayList<License> licenses = new ArrayList<License>();
    licenses.add(cl1);
    licenses.add(cl2);

    Assert.assertFalse(result.isValid(licenses));
    Assert.assertFalse(result.isInvalid(licenses));
    Assert.assertFalse(result.isWarning(licenses));
    Assert.assertTrue(result.isUnknown(licenses));
  }