예제 #1
0
  @Test
  public void testSetGetArtifactAction() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    classUnderTest.setArtifactAction(ArtifactAction.INSTALL);
    assertEquals(ArtifactAction.INSTALL, classUnderTest.getArtifactAction());
  }
예제 #2
0
  @Test
  public void testSetGetDisplayType() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    classUnderTest.setDisplayType(coreType);
    assertEquals(coreType, classUnderTest.getDisplayType());
  }
예제 #3
0
  @Test
  public void testToString() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    assertNotNull(classUnderTest.toString());
    assertTrue(classUnderTest.toString().length() > 0);
  }
예제 #4
0
  @Test
  public void testSetGetChecksum() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    assertEquals(coreChecksum, classUnderTest.getChecksum());
    classUnderTest.setChecksum(2);
    assertEquals(2, classUnderTest.getChecksum());
  }
예제 #5
0
  @Test
  public void testSetGetInstalled() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    assertEquals(coreIsInstalled, classUnderTest.isInstalled());
    classUnderTest.setInstalled(false);
    assertFalse(classUnderTest.isInstalled());
  }
예제 #6
0
  @Test
  public void testIsTranslationArtifact() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockTranslationArtifactXmlBean);
    mockHelper.verifyAll();

    assertTrue(classUnderTest.isTranslationArtifact());
    assertFalse(classUnderTest.isPluginArtifact());
    assertFalse(classUnderTest.isCoreArtifact());
  }
예제 #7
0
  @Test
  public void testSetGetType() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    assertEquals(UpdateUtil.CORE_ARTIFACT_ID, classUnderTest.getType());
    classUnderTest.setType(UpdateUtil.PLUGIN_ARTIFACT_ID);
    assertEquals(UpdateUtil.PLUGIN_ARTIFACT_ID, classUnderTest.getType());
  }
예제 #8
0
  @Test
  public void testArtifactStatusArtifactXmlBean() {
    mockHelper.replayAll();
    classUnderTest = new ArtifactStatus(mockCoreArtifactXmlBean);
    mockHelper.verifyAll();

    assertEquals(coreArtifactName, classUnderTest.getName());
    assertEquals(coreIsInstalled, classUnderTest.isInstalled());
    assertEquals(this.coreSize, classUnderTest.getSize());
    assertEquals(coreChecksum, classUnderTest.getChecksum());
  }
예제 #9
0
  @Test
  public void testEqualsAndHashCode() {
    mockHelper.replayAll();
    final ArtifactStatus a = new ArtifactStatus(mockCoreArtifactXmlBean); // original object
    final ArtifactStatus b =
        new ArtifactStatus(mockCoreArtifactXmlBean); // another object that has the
    // same values as the original
    final ArtifactStatus c =
        new ArtifactStatus(mockPluginArtifactXmlBean); // another object with different
    // values
    final ArtifactStatus d =
        new ArtifactStatus(mockCoreArtifactXmlBean) {
          private static final long serialVersionUID = 1L;
        }; // a subclass of Foo with the same values as the original
    new EqualsTester(a, b, c, d);
    mockHelper.verifyAll();

    a.setName(null);
    b.setName(null);
    d.setName(null);
    new EqualsTester(a, b, c, d);

    // different only by type - same name
    a.setName(coreArtifactName);
    b.setName(coreArtifactName);
    c.setName(coreArtifactName);
    a.setType(null);
    b.setType(null);
    d.setType(null);
    new EqualsTester(a, b, c, d);

    a.setType(coreType);
    b.setType(coreType);
    c.setType(null);
    d.setType(coreType);
    new EqualsTester(a, b, c, d);

    a.setType(null);
    b.setType(null);
    c.setType(pluginType);
    d.setType(null);
    new EqualsTester(a, b, c, d);
  }
예제 #10
0
  @Before
  public void setUp() throws Exception {
    mockCoreArtifactXmlBean = mockHelper.createMock(ArtifactXmlBean.class);
    expect(mockCoreArtifactXmlBean.getName()).andStubReturn(coreArtifactName);
    expect(mockCoreArtifactXmlBean.isInstalled()).andStubReturn(coreIsInstalled);
    expect(mockCoreArtifactXmlBean.getSize()).andStubReturn(coreSize);
    expect(mockCoreArtifactXmlBean.getChecksum()).andStubReturn(coreChecksum);
    expect(mockCoreArtifactXmlBean.getType()).andStubReturn(coreType);

    mockPluginArtifactXmlBean = mockHelper.createMock(ArtifactXmlBean.class);
    expect(mockPluginArtifactXmlBean.getName()).andStubReturn(pluginArtifactName);
    expect(mockPluginArtifactXmlBean.isInstalled()).andStubReturn(pluginIsInstalled);
    expect(mockPluginArtifactXmlBean.getSize()).andStubReturn(pluginSize);
    expect(mockPluginArtifactXmlBean.getChecksum()).andStubReturn(pluginChecksum);
    expect(mockPluginArtifactXmlBean.getType()).andStubReturn(pluginType);

    mockTranslationArtifactXmlBean = mockHelper.createMock(ArtifactXmlBean.class);
    expect(mockTranslationArtifactXmlBean.getName()).andStubReturn(translationArtifactName);
    expect(mockTranslationArtifactXmlBean.isInstalled()).andStubReturn(translationIsInstalled);
    expect(mockTranslationArtifactXmlBean.getSize()).andStubReturn(translationSize);
    expect(mockTranslationArtifactXmlBean.getChecksum()).andStubReturn(translationChecksum);
    expect(mockTranslationArtifactXmlBean.getType()).andStubReturn(translationType);

    // For the serialization test in superclass - cannot use mockHelper because the replay needs to
    // be
    // done here.
    ArtifactXmlBean mockArtifactXmlBean = EasyMock.createMock(ArtifactXmlBean.class);
    expect(mockArtifactXmlBean.getName()).andStubReturn(coreArtifactName);
    expect(mockArtifactXmlBean.isInstalled()).andStubReturn(coreIsInstalled);
    expect(mockArtifactXmlBean.getSize()).andStubReturn(coreSize);
    expect(mockArtifactXmlBean.getChecksum()).andStubReturn(coreChecksum);
    expect(mockArtifactXmlBean.getType()).andStubReturn(coreType);
    replay(mockArtifactXmlBean);
    super.serializableToTest = new ArtifactStatus(mockArtifactXmlBean);
    verify(mockArtifactXmlBean);
  }